The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Doubts in watershed transform command
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  

Posts: 3
Registered: 7/27/11
Doubts in watershed transform command
Posted: Jul 27, 2011 12:11 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

One of the image processing method I'm using and studying now is watershed segmentation, and I find the examples available in Matlab is very useful. I tried it on my own image and it works just fine with some modification.
However, there's few commands that I don't understand in the example, and I hope someone can help me with it:

2.Compute the distance transform of the complement of the binary image.
D = bwdist(~bw);
figure, imshow(D,[],'InitialMagnification','fit')
title('Distance transform of ~bw')

3.Complement the distance transform, and force pixels that don't belong to the objects to be at -Inf.
D = -D;
D(~bw) = -Inf;

Q1. What does '~ ' do in (~bw)? Why does it affect the gradient of image in computing the distance transform?
Q2. In 3, why does the D needed to be complemented?
Q3. What is the purpose of making the 'unrelated' pixels -Inf?


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.