实用小工具---显示图像点坐标和点的rgb值

本文介绍了如何使用Python创建一个工具,该工具能够显示图像中像素点的坐标及其对应的RGB值。通过在Python27下建立mytool文件夹并编写showpicture.py脚本,可以实现对图像如trex.png的处理。在Eclipse环境下也能直接运行此功能。
摘要由CSDN通过智能技术生成

第一步:在python27文件夹下建立一个mytool文件夹,然后创建showpicture.py

#coding:utf-8 
'''
python showpicture.py --image *.png
'''

from PIL import Image  
from pylab import *  
from PCV.tools import imtools
import argparse
import cv2  
ap = argparse.ArgumentParser()
ap.add_argument("-i","--image",required=True,help="Path to the image")
args = vars(ap.parse_args())
 
from matplotlib.font_manager import FontProperties  
font = FontProperties(fname=r"C:/Windows/Fonts/msyh.ttc", size=14)  
#im = array(Image.open('C:/pytm/pic/ceshi.jpg').convert('L'))  
im1 = array(Image.open(args["image"]))
    
subplot()  
axis('off')   
title(u'Picture', fontproperties=font)  
imshow(im1)  

  
show()  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值