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

相关文章

Python随手笔记之标准类型内建函数

Python提供了一些内建函数用于基本对象类型:cmp(),repr(),str(),type()和等同于repr()的(' ')操作符 (1)type()    t...

pycharm debug功能实现跳到循环末尾的方法

pycharm debug功能实现跳到循环末尾的方法

可以使用条件断点,如图,在断点上右键可以设置,条件自己输入,python语法: 以上这篇pycharm debug功能实现跳到循环末尾的方法就是小编分享给大家的全部内容了,希望能给大家...

python在html中插入简单的代码并加上时间戳的方法

python在html中插入简单的代码并加上时间戳的方法

建议用pycharm,使用比较方便,并且可以直接编辑html文件 import time locatime = time.strftime("%Y-%m-%d" ) report =...

python SMTP实现发送带附件电子邮件

本文实例为大家分享了python SMTP发送带附件电子邮件的具体代码,供大家参考,具体内容如下 可采用email模块发送电子邮件附件。发送一个未知MIME类型的文件附件其基本思路如下:...

Django应用程序入口WSGIHandler源码解析

前言 WSGI 有三个部分, 分别为服务器(server), 应用程序(application) 和中间件(middleware). 已经知道, 服务器方面会调用应用程序来处理请求, 在...