bwdist is computing image complement

I have a binary image and used bwdist on the image and the resulting image was the exact compliment of the original image. I thought that bwdist would return a grayscale image based (obviously) on the distance transform. The original image is essentially an asymmetric blob of white surrounded by black, so I expected bwdist to return the same shape but with blurred borders (I need the distance transform data so just blurring the edges is not an option). Am I just expecting something that this function does not do?

 Respuesta aceptada

Sean de Wolski
Sean de Wolski el 23 de Mayo de 2011
It is probably not just the complement as you suspect. You're probably viewing it on the range [0 1] so values greater than or equal (all false values in the original) appear to be true. What is returned if you enter:
range(D(:)); %D is the output of bwdist
try viewing a slice of it over the whole range, i.e.:
imshow(D,[]);
or
imtool(D); %play with adjust contrast button.

1 comentario

Christopher
Christopher el 23 de Mayo de 2011
Ok I get it. I didn't realize bwdist returned unscaled values. Thanks

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by