Quantcast
Viewing all articles
Browse latest Browse all 14040

identifying if an image is Binary image, Gray scale image or Color image

I have a directory with many images that are in these 3 scale: binary, gray scale and colorful.using cv2 i managed to check if the image is colorful or not.

def color_type(address):    image = cv2.imread(address,-1)    b,g,r = cv2.split(image)    comp_1 = b==g    comp_2 = b==r    if comp_1.all() and comp_2.all():        return 'The Image is gray scale'    else:        return 'The Image has colors'

i can't find a way to separate binary images and gray scale image. I will be grateful if anyone would help me.


Viewing all articles
Browse latest Browse all 14040

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>