使用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 request设置HTTPS代理代码解析

之前版本的代理中,可以使用fiddler进行HTTP包的代理,但是代理HTTPS包时,执行错误 self._sslobj.do_handshake() ssl.SSLError:...

利用 python 对目录下的文件进行过滤删除

利用 python 对目录下的文件进行过滤删除

前言 最近学习了python,感觉挺多地方能用到它的。打包 测试 上传 爬电影....而且代码量是真少。人生苦短,我用python。而今天写的这个是因为下载电影时总会发现除了视频还会有这...

Django rest framework工具包简单用法示例

本文实例讲述了Django rest framework工具包简单用法。分享给大家供大家参考,具体如下: Django rest framework 工具包做API非常方便。 下面简单说...

python3.4 将16进制转成字符串的实例

将socket收到的16进制转成字符串 def hex_to_str(b): s = '' for i in b: s += '{0:0>2}'.format...

使用python制作游戏下载进度条的代码(程序说明见注释)

使用python制作游戏下载进度条的代码(程序说明见注释)

import time # time模块中包含了许多与时间相关的模块,其中通过time()函数可以获取当前的时间。 count = 100 print("开始下载".center(...