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

yipeiwu_com5年前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设计】网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

相关文章

利用pandas进行大文件计数处理的方法

Pandas读取大文件 要处理的是由探测器读出的脉冲信号,一组数据为两列,一列为时间,一列为脉冲能量,数据量在千万级,为了有一个直接的认识,先使用Pandas读取一些 import...

Windows下Anaconda的安装和简单使用方法

Windows下Anaconda的安装和简单使用方法

Anaconda is a completely free Python distribution (including for commercial use and redistrib...

python3.5 email实现发送邮件功能

本文实例为大家分享了python3.5 email发送邮件的具体代码,供大家参考,具体内容如下 直接套用代码即可 from email.mime.text import MIMETe...

Java及python正则表达式详解

Java及python正则表达式详解

正则表达式语法及常用元字符: 正则表达式有元字符及不同组合来构成,通过巧妙的构造正则表达式可以匹配任意字符串,并完成复杂的字符串处理任务。 常用的元字符有: 其中在使用反斜线时要注意:如...

Python中的Socket 与 ScoketServer 通信及遇到问题解决方法

Socket有一个缓冲区,缓冲区是一个流,先进先出,发送和取出的可自定义大小的,如果取出的数据未取完缓冲区,则可能存在数据怠慢。其中【recv(1024)】表示从缓冲区里取最大为1024...