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

1 回表示 (過去 30 日間)
raym
raym 2020 年 12 月 8 日
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 Center および File ExchangeImport, Export, and Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by