使用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实现字典依据value排序

具体内容如下: 使用sorted将字典按照其value大小排序 >>> record = {'a':89, 'b':86, 'c':99, 'd':100} &g...

python编程开发之textwrap文本样式处理技巧

本文实例讲述了python编程开发之textwrap文本样式处理技巧。分享给大家供大家参考,具体如下: 在看python的API的时候,发现python的textwrap在处理字符串样式...

Pyhton中单行和多行注释的使用方法及规范

Pyhton中单行和多行注释的使用方法及规范

前言 注释可以起到一个备注的作用,团队合作的时候,个人编写的代码经常会被多人调用,为了让别人能更容易理解代码的通途,使用注释是非常有效的。 Python  注释符 一、py...

详解Django的model查询操作与查询性能优化

1 如何 在做ORM查询时 查看SQl的执行情况 (1) 最底层的 django.db.connection 在 django shell 中使用  python manag...

Python中的深拷贝和浅拷贝详解

Python中的深拷贝和浅拷贝详解

要说清楚Python中的深浅拷贝,需要搞清楚下面一系列概念: 变量-引用-对象(可变对象,不可变对象)-切片-拷贝(浅拷贝,深拷贝) 【变量-对象-引用】 在Python中一切都是对象,...