使用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三种遍历文件目录的方法实例代码

本文实例代码主要实现的是python遍历文件目录的操作,有三种方法,具体代码如下。 #coding:utf-8 # 方法1:递归遍历目录 import os def v...

Python模拟脉冲星伪信号频率实例代码

Python模拟脉冲星伪信号频率实例代码

脉冲星假信号频率的相对路径论证。 首先看一下演示结果: 实例代码: import numpy as np import matplotlib.pyplot as plt impor...

python实现实时监控文件的方法

在业务稳定性要求比较高的情况下,运维为能及时发现问题,有时需要对应用程序的日志进行实时分析,当符合某个条件时就立刻报警,而不是被动等待出问题后去解决,比如要监控nginx的$reques...

tensorflow实现加载mnist数据集

tensorflow实现加载mnist数据集

mnist作为最基础的图片数据集,在以后的cnn,rnn任务中都会用到 import numpy as np import tensorflow as tf import matpl...

Python中List.count()方法的使用教程

 count()方法返回obj出现在列表的次数。 语法 以下是count()方法的语法: list.count(obj) 参数   &nbs...