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

相关文章

Windows下用py2exe将Python程序打包成exe程序的教程

py2exe在sourceforge 的下载只支持到2.7。 针对python3.0+的版本,需要自己编译。 1.下载源码 svn checkout svn://svn.code.sf....

django进阶之cookie和session的使用示例

django进阶之cookie和session的使用示例

Cookies :是浏览器为 Web 服务器存储的一小段信息。 每次浏览器从某个服务器请求页面时,它收到服务器回发送过来的cookies。它保存在浏览器下的某个文件夹下。 Sessi...

python下读取公私钥做加解密实例详解

python下读取公私钥做加解密实例详解 在RSA有一种应用模式是公钥加密,私钥解密(另一种是私钥签名,公钥验签)。下面是Python下的应用举例。 假设我有一个公钥文件,rsa_pub...

Python Pandas 箱线图的实现

Python Pandas 箱线图的实现

各国家用户消费分布 import numpy as np import pandas as pd import matplotlib.pyplot as plt data...

用Python写一个自动木马程序

用Python写一个自动木马程序

电脑作为大家日常办公的工具,最怕的一件事情之一就是被偷,当我们的电脑被盗的时候,不仅仅是电脑本身,更重要的是电脑存储的资料都会丢失。如何尽快的找回电脑需要我们想点办法,今天就教大家一个...