使用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缓存技术实现过程详解

一段非常简单代码 普通调用方式 def console1(a, b): print("进入函数") return (a, b) print(console1(3, 'a...

在python中pandas的series合并方法

如下所示: In [3]: import pandas as pd In [4]: a = pd.Series([1,2,3]) In [5]: b = pd.Series(...

PyTorch中topk函数的用法详解

PyTorch中topk函数的用法详解

听名字就知道这个函数是用来求tensor中某个dim的前k大或者前k小的值以及对应的index。 用法 torch.topk(input, k, dim=None, largest=...

python自动化生成IOS的图标

本文实例为大家分享了python自动化生成IOS的图标,供大家参考,具体内容如下 每次上架之前都要生成十几个图片感觉无聊麻烦,考虑使用脚本处理 脚本使用python 和一部分shel...

django框架面向对象ORM模型继承用法实例分析

本文实例讲述了django框架面向对象ORM模型继承用法。分享给大家供大家参考,具体如下: Django ORM对模型继承的支持,将python面向对象的编程方法与数据库面向关系表的数据...