Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine whether an image is binary or grayscale?

 have an image and I don't have the pallet details of that image.  I just want to determine whether the image is binary or grayscale image using some algorithms.  I thought finding it with maximum pixel value.  i.e., if pixel value of the image is more tha 16 then it is greyscale else it would be binary.  But I found this value with each pixel of the image and then determined the maximum pixel value.  Thus it ultimately took more time (about 14ms) than I expected.  I want some algorithm which takes very less time to find it.  Can anybody help out?

--
Ajay MV


0 Kudos
Message 1 of 2
(3,656 Views)
Have a look at the histogram function and then use the standard deviation of the image. This does depend on the two values you have for binary though. The other way is to check for a difference in the mode and median. As histogram functions you should be much faster than the pixel by pixel approach. If the max value is working for you you will also get this out of the histogram function.

Good luck

Mike
0 Kudos
Message 2 of 2
(3,635 Views)