im2bw get different binary results on same data between double and uint8 in R2016a
2 次查看(过去 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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Import, Export, and Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!