Read in image file and convert into binary file with and without treshold value of your selection ?

 Accepted Answer

To create a binary image from an integer or floating point image, threshold like this:
binaryImage = yourImage < thresholdValue; % Can use >, >=, or other operators also.

5 Comments

Thank you so much , but how can i create binary image from Integer or float point ??
i wrote
im=imread('d:\\photo.jpg'); binaryImage = im < 1; imshow(im); figure; imshow(binaryimage);
where is wrong? i didnt find
Perhaps the image was RGB? If so then
binaryimage = rgb2gray(im) < 1;
Perhaps im has no 0's in it, so the entire binary image is false (black) because the criteria that im is less than 1 is never met.

Sign in to comment.

More Answers (1)

Almost all image files are already binary files. About the only ones that are not are PBM and PPM files.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!