使用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 leetcode 字符串相乘实例详解

给定两个以字符串形式表示的非负整数 num1 和  num2 ,返回  num1 和  num2 的乘积,它们的乘积也表示为字符串形式。 示例 1: 输入:...

Django框架之中间件MiddleWare的实现

Django中的中间件是一个轻量级、底层的插件系统,可以介入Django的请求和响应处理过程,修改Django的输入或输出。 中间件的设计为开发者提供了一种无侵入式的开发方式,增强了Dj...

python cx_Oracle的基础使用方法(连接和增删改查)

问题 使用python操作oracle数据库,获取表的某几个字段作为变量值使用。 使用Popen+sqlplus的方法需要对格式进行控制,通过流获取这几个字段值不简洁(个人观点……)。...

python中关于日期时间处理的问答集锦

如何在安装setuptools模块时不生成egg压缩包而是源码     Q:如何在安装setuptools模块时不生成egg压缩包而是源码,这样有时可以修改...

python自动翻译实现方法

本文实例讲述了python自动翻译实现方法。分享给大家供大家参考,具体如下: 以前学过python的基础,一般也没用过。后来有一个参数表需要中英文。想了一下,还是用python做吧。调用...