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

来源:互联网 发布:宝宝学加减法软件 编辑:程序博客网 时间:2024/05/19 10:55

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

#coding:utf-8 '''python showpicture.py --image *.png'''from PIL import Image  from pylab import *  from PCV.tools import imtoolsimport argparseimport 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()    




0 0
原创粉丝点击