How to convert a 128x128 or 256x256 grayscale image into a b
How to convert a 128x128 or 256x256 grayscale image into a binary bitsream in mat lab?
Solution
use matlab function im2bw, this function evaluates an image between (min,max) instead of your normal 0 to 255 for grayscale.. just normalise it to 0 to 1.
from the description of the im2bw() function - converts the grayscale image I to a binary image. The output image BW replaces all pixels in the input image with luminance greater than level with the value 1 (white) and replaces all other pixels with the value 0 (black). Specify level in the range [0,1]. This range is relative to the signal levels possible for the image\'s class. Therefore, a level value of 0.5 is midway between black and white, regardless of class. To compute the level argument, you can use the function graythresh. If you do not specify level, im2bw uses the value 0.5.
