Answer the question
In order to leave comments, you need to log in
How to determine if an image is grayscale using Opencv?
Greetings!
It must be understood that the image is black and white (in grayscale) or color in the fastest way.
Please tell me this way.
PS the picture is originally RGB, iterate over each pixel and look at the threshold for too long.
Answer the question
In order to leave comments, you need to log in
For a perfectly gray pixel, R=G=B will be true.
You can also convert RGB to HSV (Hue-Saturation-Value) and check the value of S. The ideal shade of gray in a pixel would be S=0. For a non-ideal gray (for example, scanning an A4 sheet in a scanner in RGB mode), the value of S will be close to 0.
Some calculate for each pixeldelta = abs(R-G) + abs(G-B) + abs(B-R)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question