使用Python实现图像标记点的坐标输出功能

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

相关文章

使用pytorch和torchtext进行文本分类的实例

文本分类是NLP领域的较为容易的入门问题,本文记录我自己在做文本分类任务以及复现相关论文时的基本流程,绝大部分操作都使用了torch和torchtext两个库。 1. 文本数据预处理 首...

用python简单实现mysql数据同步到ElasticSearch的教程

之前博客有用logstash-input-jdbc同步mysql数据到ElasticSearch,但是由于同步时间最少是一分钟一次,无法满足线上业务,所以只能自己实现一个,但是时间比较紧...

Kali Linux安装ipython2 和 ipython3的方法

1、更新包管理 apt-get install update. 2、安装 pip3 :apt-get install python3-pip 3、安装ipython 2 : pip in...

使用Python的datetime库处理时间(RPA流程)

RPA流程自动化过程中,遇到时间的相关操作时,可以调用datetime库的一些方法进行处理。 datetime 是 Python 处理日期和时间的标准库。 1、获取当前日期和时间 我们先...

Python使用matplotlib绘制三维图形示例

Python使用matplotlib绘制三维图形示例

本文实例讲述了Python使用matplotlib绘制三维图形。分享给大家供大家参考,具体如下: 用二维泡泡图表示三维数据 泡泡的坐标2维,泡泡的大小三维,使用到的函数 plt.sc...