使用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同时给两个收件人发送邮件的方法

本文实例讲述了python同时给两个收件人发送邮件的方法。分享给大家供大家参考。具体分析如下: 该范例通过python内置的smtplib包发送邮件 import smtplib i...

PyQtGraph在pyqt中的应用及安装过程

PyQtGraph在pyqt中的应用及安装过程

1.PyQtGraph简介: pyqtgraph的主要用途: 1、为数据、绘图、视频等提供快速、可交互图形显示。 2、提供快速开发应用的工具。 2.PyQtGraph的安装: pip i...

在python里面运用多继承方法详解

在python里面运用多继承方法详解

如何在PYTHON里面运用多继承 class Father: def hobby(self): print("love to play video game.")...

Python将一个Excel拆分为多个Excel

Python将一个Excel拆分为多个Excel

本文实例为大家分享了Python将一个Excel拆分为多个Excel的具体代码,供大家参考,具体内容如下 原始文档如下图所示 将销售部门一、二、三科分别存为三个Excel 代码如下...

在IPython中进行Python程序执行时间的测量方法

在写MATLAB的脚本的时候我时长会用tic、toc进行一下程序运行时间的测量。在Python中偶尔也会测试下,但是基本上都是靠使用time模块。接触了IPython之后突然间发现,原来...