Python CV2 Читать изображение серого
import cv2
im_gray = cv2.imread('grayscale_image.png', cv2.IMREAD_GRAYSCALE)
Jittery Jellyfish
import cv2
im_gray = cv2.imread('grayscale_image.png', cv2.IMREAD_GRAYSCALE)
from scipy.misc import imread, imsave, imresize
image = imread(f_name)
if(len(image.shape)<3):
print 'gray'
elif len(image.shape)==3:
print 'Color(RGB)'
else:
print 'others'
import cv2
file = "myFile.jpj"
image = cv2.imread(file)
if image.any() != None:
if(len(image.shape)<2):
print ('grayscale')
elif len(image.shape)==3:
print ('Colored')
else:
print("cannot find image")