使用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 调用pyautogui 实时获取鼠标的位置、移动鼠标的方法

python 调用pyautogui 实时获取鼠标的位置、移动鼠标的方法

PyAutoGUI是一个纯Python的GUI自动化工具,其目的是可以用程序自动控制鼠标和键盘操作,利用它可以实现自动化任务 本章介绍了许多不同函数,下面是快速的汇总参考: moveTo...

Tensorflow中的placeholder和feed_dict的使用

TensorFlow 支持占位符placeholder。占位符并没有初始值,它只会分配必要的内存。在会话中,占位符可以使用 feed_dict 馈送数据。 feed_dict是一个字典...

python Tkinter的图片刷新实例

调用python自带的GUI制作库 一开始想用Tkinter制作GUI的,网上说是python自带的,结果输入: import tkinter 后,显示: _ImportErr...

python使用MySQLdb访问mysql数据库的方法

本文实例讲述了python使用MySQLdb访问mysql数据库的方法。分享给大家供大家参考。具体如下: #!/usr/bin/python import MySQLdb def d...

Python实现的查询mysql数据库并通过邮件发送信息功能

本文实例讲述了Python实现的查询mysql数据库并通过邮件发送信息功能。分享给大家供大家参考,具体如下: 这里使用Python查询mysql数据库,并通过邮件发送宕机信息。 Pyth...