ali kiani ali kiani - 2 months ago 7
C++ Question

how detect rgb image format really is gray?

i have image processing program with opencv c++.
inmy program two preprocessing path is for 2 type of gray level images and color images.
but some times i get images is graylevel but store in RGB format means when look image is gray but this image have 3 channel.

how i can detect a rgb image format is really colored or gray ?


Nearly all colors of grey have red == green == blue. Simply checking that red green and blue values are +10 or -10 should do the trick.

If instead you wish for a particular form of gray, you can check out this website to see the relevant colours of gray that can be formed or experiment yourself on a RGB input portal.