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?

 采纳的回答

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 个评论

Ok I get it. I didn't realize bwdist returned unscaled values. Thanks

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by