How to find the distance between regions?

Hey,
I have a BW image in which there are some regions with irregular shapes. I'd like to calculate the following information for each particle;
1- the minimum distance to other particles.
2-maximum distance to the neighboring particles
3- Average value of distance from this particles edges to the neighboring particles.
I was thinking to put a circle at the centroid of the region and then grow the radius of the circle to touch the first particle. this would be the the minimum distance. and continue again to touch the other particles and finally calculate the average value.
any ideas?

 Accepted Answer

Have you looked at bwdist()?

13 Comments

No, how it works?
It works pretty well.
Where did you upload your images to?
Did you want the distance from borders to borders or centroids to centroids?
Bob,
Along with bwdist(), read the documentation on regionprops(). Should give you anything you wanted to know about morphological analysis.
I tried it. But how can I get the data I need (as I explained above)?
bob - see my comment above.
Hi,
I tried bwdist(), and it works well. However, using bwlabel() I labeled the regions. Now I want to use bwdist() for the selective size(area or length) of the regions.But I couldn't do that.
For example for the region 1, I'd like to measure the mean distance to the neighboring regions!
I'm not sure what this means: "I want to use bwdist() for the selective size(area or length) of the regions" Have you looked at my image segmentation demo in my File Exchange? http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 It selects objects based on criteria such as size. But it sounds like you want to find all the centroids and simply use the Pythagorean theorem to find the distance from a centroid to all the other centroids.
What I want is to calculate the distance between the edges of a region to all neighboring regions. distance between the centroids is not useful here. The photo I have is a micrograph of a material composed of some particles and the binder which is between the particles. Particles have irregular shape. so, what I want is the mean value of the thickness of the binder between particles.
-What is the mean thickness of the binder around individual particles
-What is the mean thickness of the binder for particles within the seize range of a-b.
Thank you
Is there any reason why you didn't answer my question from July 6: "Where did you upload your images to?" Are you expecting people to answer questions on image processing without an image to look at? How good do you expect those answers to be?
No, actually I just didn't notice that. How can I upload an image?
If you're looking at the closest distance of a particle's edge to any other possible edge pixel of any other particle, then bwdist can't do that. You'd have to use bwboundaries and do a brute force approach. It's not many coordinates though, so it should be pretty fast. Let's see your code for that and we can discuss it.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!