实用小工具---显示图像点坐标和点的rgb值
第一步:在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()
第二步,在cmd中运行:
(假设在python27/mytool下有一个trex.png图像)
python showpicture.py --image trex.png
第二版:
直接在eclipse上运行的:
#coding:utf-8
'''''
python showpicture.py --image *.png
''' from PIL import Image
from pylab import * from matplotlib.font_manager import FontProperties
font = FontProperties(fname=r"C:/Windows/Fonts/msyh.ttc", size=14) im1 = array(Image.open('d:/0000/5/5.jpg'))
subplot()
gray()
axis('off')
title(u'Picture', fontproperties=font)
imshow(im1) show()
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
