How to convert bitmap image to binary image in android?
10,684
Are you looking for an algorithm to perform the conversion?
The easiest way is to compare each pixel value with a fixed threshold: if the pixel value is less than the threshold, the corresponding output pixel is black (0), else it is white (1).
If you wish to determine the threshold automatically, you may want to implement Otsu's method. That method does a correct job overall when you can't make too many assumptions about the pixels distribution in your image.
http://en.wikipedia.org/wiki/Otsu%27s_Method
As a reference, that's how it looks like in Mathematica:
Binarize[image, threshold]
, and Binarize[img]
for Otsu's method.
Author by
barzos
Updated on June 15, 2022Comments
-
barzos almost 2 years
I need to convert bitmap to binary image for my hw.Do u know anything about that?
-
Kevin Gaudin about 13 yearsstart with giving more details about what you need. Your question does not make much sense.
-
barzos about 13 yearsI didnt get any idea of converting binary image