Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

detect grayscale image in python opencv

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")  
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #detect #grayscale #image #python #opencv
ADD COMMENT
Topic
Name
2+6 =