使用Python实现图像标记点的坐标输出功能

yipeiwu_com6年前Python基础

Sometimes we have need to interact  with an application,for example by marking points in an image,or you need to annotation some training data.PyLab comes with a simple function ginput() the let's you do just that .Here's a short example.

from PIL import Image
from pylab import *
im = array(Image.open('test.jpg'))
imshow(im)
print 'Please click 3 points'
x =ginput(3)
print 'you clicked:',x
show()

This plots an image and waits for the user to click three times in the image region of the figures window.The coordinates[x,y] of the clicks are saved in a list x.

总结

以上所述是小编给大家介绍的使用Python实现图像标记点的坐标输出功能 ,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对【听图阁-专注于Python设计】网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

相关文章

python通过pil模块将raw图片转换成png图片的方法

本文实例讲述了python通过pil模块将raw图片转换成png图片的方法。分享给大家供大家参考。具体分析如下: python通过pil模块将raw图片转换成png图片,pil中包含了f...

基于python实现学生信息管理系统

基于python实现学生信息管理系统

学生信息管理系统负责编辑学生信息,适时地更新学生的资料。下面通过python实现一个简单的学生信息管理系统 stuInfo=[] def main(): while True:...

Python 装饰器@,对函数进行功能扩展操作示例【开闭原则】

本文实例讲述了Python 装饰器@,对函数进行功能扩展操作。分享给大家供大家参考,具体如下: 装饰器可以对原函数进行功能扩展,但还不需要修改原函数的内容(开闭原则),也不需要修改原函数...

Sanic框架请求与响应实例分析

本文实例讲述了Sanic框架请求与响应。分享给大家供大家参考,具体如下: 前面介绍了Sanic框架的路由,这里接着介绍Sanic框架的请求与响应。 简介 Sanic是一个类似Flask的...

Django项目中实现使用qq第三方登录功能

Django项目中实现使用qq第三方登录功能

使用qq登录的前提是已经在qq互联官网创建网站应用并获取到QQ互联中网站应用的APP ID和APP KEY 1,建路由 # qq登录 path('loginQq/',qq.log...