Converting from grayscale to binary image gives error

Hi everybody I convert my image from grayscale to binary image, however, the result is completely black. I attached my code and images. Could you please help me with that?
if true
grayImage=imread('20x.png');
binaryImage = im2bw(grayImage,0.4);
binaryImage = imfill(binaryImage, 'holes');
imshow(binaryImage, []);
end

 Akzeptierte Antwort

jonas
jonas am 13 Aug. 2018
Bearbeitet: jonas am 13 Aug. 2018

0 Stimmen

The threshold (0.4) is too high. Reduce the threshold (to e.g. 0.2) or use imbinarize instead of im2bw (recommended).

Weitere Antworten (0)

Kategorien

Mehr zu Convert Image Type finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 13 Aug. 2018

Bearbeitet:

am 13 Aug. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by