Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

A first approach would be to check the numbers of channels of the loaded image. However, that would not work in case of where a grayscale/binary image is transformed to a 3-channel image. However, here you could apply another check, since in a grayscale/binary image the pixel values are gonna have the same value in all channels i.e. R=G=B. But still that might not be enough, therefore lastly you could just loop over the histogram of channel/channels of the image and take the average of pixel color weighed by the pixel count. I think combining all these three checks would give you what you want.