im2bw get different binary results on same data between double and uint8 in R2016a
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Import, Export, and Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!