using greythresh and im2bw

1 visualización (últimos 30 días)
Douglas Brenner
Douglas Brenner el 6 de Nov. de 2016
Editada: Image Analyst el 6 de Nov. de 2016
Figure 1 is great but BW is all black. Thoughts? Thanks
figure (1)
scaled = 255 * width/MAX;
level = graythresh(scaled)
BW = im2bw(scaled,level);

Respuesta aceptada

Walter Roberson
Walter Roberson el 6 de Nov. de 2016
BW is logical, just 0 and 1. When you uint8() that, you are creating an image with just uint8(0) and uint8(1), which is too dark to be visible.
You are also doing the grayscale conversion on a double array that is out of range for valid double coefficients, and that is affecting your output.
figure (1)
scaled = 255 * width/MAX;
scaled8 = uint8(scaled);
level = graythresh(scaled8);
BW = im2bw(scaled8, level);
  3 comentarios
Image Analyst
Image Analyst el 6 de Nov. de 2016
Editada: Image Analyst el 6 de Nov. de 2016
Douglas, what is "width"? It's not a scalar is it? It's a 2 or 3-D image, right? Otherwise scaled will not be an image - it will just be a single number.

Iniciar sesión para comentar.

Más respuestas (0)


Más información sobre Display and Exploration 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!

Translated by