使用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中numpy的矩阵、多维数组的用法

1. 引言 最近在将一个算法由matlab转成python,初学python,很多地方还不熟悉,总体感觉就是上手容易,实际上很优雅地用python还是蛮难的。目前为止,觉得就算法仿真研究...

numpy np.newaxis 的实用分享

如下所示: >> type(np.newaxis) NoneType >> np.newaxis == None True np.newaxis 在使用和功...

python 七种邮件内容发送方法实例

一、文件形式的邮件复制代码 代码如下:#!/usr/bin/env python3#coding: utf-8import smtplibfrom email.mime.text imp...

python 基础教程之Map使用方法

Python Map Map会将一个函数映射到一个输入列表的所有元素上。Map的规范为:map(function_to_apply, list_of_inputs) 大多数时候,我们需...

Python 用turtle实现用正方形画圆的例子

Python 用turtle实现用正方形画圆的例子

最近发现一个很有意思的画图的python库,叫做turtle,这里先说下用turtle这个库来实现用正方形画圆的思路。 每次都用乌龟(turtle)来画出一个正方形,然后通过旋转3°后,...