How to convert logical form to binary form image?
Afficher commentaires plus anciens
My question, how to convert logical value to binary form? Here's my codes:-
%To convert the input image to pure black and white to highlight the abnormality region and its background
I2=imread('resizeLAP 1 OC -200001.jpg');
threshold=graythresh(I2);
bw=im2bw(I2,threshold);
%To display the pure black and white of the input image
imshow(bw);
imwrite(bw,'thresresizeLAP 1 OC -200001.jpg');
%To remove image noise which consists of extraneous pixels in the objects
%of interest (abnormality region) in order to obtain accurate calculation
bw=bwareaopen(bw,30);
se=strel('disk',2);
bw=imclose(bw,se);
imshow(bw);
imwrite(bw,'openresizeLAP 1 OC -200001.jpg');

The bw is in logical value form 0 and 1 value when I open. But then, when I use this codes:-
J=im2uint8(bw);
imshow(J);
imwrite(J,'8openresizeLAP 1 OC -200001.jpg');
It shown not 0 and 1 value, but it shown the value between 0 to 255. Why is this possible occur? How can I make it to 0 and 1 value?
And the reason why I use uint8 code is for tally with my input data which in uint8 value.

Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
