Previously, I tried convert a color image into a greyscale image by using pixel values of an image from a simple formula :-
Grey = 0.3*Red + 0.58*Green + 0.11*Blue
After that, I wanted to convert the greyscale image into a binary image & I used two different techniques :
NOTE : Red, Green & Blue are variables storing Greyscale intensity of the Pixel.
1. Algorithm 1:
if Red <= 127: Red = 0 Green = 0 Blue = 0 else: Red = 1 Green = 1 Blue = 1
2. Algorithm 2:
if Red <= AvgIntensity: Red = 0 Green = 0 Blue = 0 else: Red = 1 Green = 1 Blue = 1
where, AvgIntensity represents the average intensity of all the pixels of the image.
(Obviously,) the algorithms turned out to be wrong, producing incorrect output. So, I wanted to know about the correct way for greyscale to binary image conversion.