im2bw get different binary results on same data between double and uint8 in R2016a

조회 수: 1 (최근 30일)
Hi, I am using im2bw to convert a RGB image to binary, but get very different results when image was in uint8 or double format.
How does this difference appear?
which results should I trust?
Thanks.
a= [];
a(:,:,1) = [ 1 2 6 7 6;
1 1 8 7 8;
1 1 9 6 7;
1 2 7 8 6;
1 2 6 8 7];
a(:,:,2) = [ 0 0 0 0 0;
0 0 0 0 0;
0 0 0 0 0;
0 0 0 0 0;
0 0 0 0 0];
a(:,:,3) = [0 0 0 0 0;
0 0 0 0 0;
0 0 0 0 0;
0 0 0 0 0;
0 0 0 0 0];
graythresh(a)%0.4980
imshow(im2bw(a)) % shows a normal binary image
graythresh(uint8(a)) %0.0137
imshow(im2bw(uint8(a))) % shows only black. All information is lost.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Import, Export, and Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by