打印图像的红色值

时间:2018-02-11 03:49:59

标签: python-3.x

 import cv2
 import glob
 import numpy as np
 print("Dude Test me \n")
 sample_folder=input("Enter the image containg folder you want to test :  ")
 sample_image=input("Enter image name(number) : ")
 print(str(sample_image)+'.png')
 for i in glob.glob('E:\dataset\TRAINING DATA\small\a\str(sample_image)+'.png''):
     img1=cv2.imread(i)
     b,g,r=cv2.split(img1)
     red_value1=np.array(r)
     dup_input_vector1=red_value1.reshape(7990,1)
     dup_input_vector1[dup_input_vector1==255]=1
     print(dup_input_vector1.shape)

我是否正确使用了str()函数?..如果我将输入图像设为2 ..它应该取2.png图像并单独打印其红色值..帮助我..

0 个答案:

没有答案