使用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实现中文分词FMM算法实例

本文实例讲述了python实现中文分词FMM算法。分享给大家供大家参考。具体分析如下: FMM算法的最简单思想是使用贪心算法向前找n个,如果这n个组成的词在词典中出现,就ok,如果没有出...

Python Django切换MySQL数据库实例详解

准备 软件 版本 Django 2.1.3 Pytho...

selenium+python实现自动登陆QQ邮箱并发送邮件功能

selenium+python实现自动登陆QQ邮箱并发送邮件功能

本期做一个selenium详细实例,会把我在元素定位中遇到的一些阻塞和经验分享给大家。 (浏览器为Chrome) (如果只需要最终的完整代码,请直接跳转到文章最后) 浏览器打开QQ邮箱...

Pytorch DataLoader 变长数据处理方式

关于Pytorch中怎么自定义Dataset数据集类、怎样使用DataLoader迭代加载数据,这篇官方文档已经说得很清楚了,这里就不在赘述。 现在的问题:有的时候,特别对于NLP任务...

python连接mysql数据库示例(做增删改操作)

一、相关代码数据库配置类 MysqlDBConn.py 复制代码 代码如下:#encoding=utf-8'''Created on 2012-11-12Mysql Conn连接类'''...