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

 채택된 답변

jonas
jonas 2018년 8월 13일
편집: jonas 2018년 8월 13일

0 개 추천

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2018년 8월 13일

편집:

2018년 8월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by