Horje
cv2 check if image is grayscale Code Example
python cv2 read image grayscale
import cv2
im_gray = cv2.imread('grayscale_image.png', cv2.IMREAD_GRAYSCALE)
cv2 check if image is 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'
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")  




Python

Related
how to use random tree in python Code Example how to use random tree in python Code Example
Groups the DataFrame using the specified columns Code Example Groups the DataFrame using the specified columns Code Example
how to convert adjacency list to adjacency matrix Code Example how to convert adjacency list to adjacency matrix Code Example
python logger get level Code Example python logger get level Code Example
how to input a string in streamlit Code Example how to input a string in streamlit Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7