Finding the distance between two objects... Please help!

http://www.flickr.com/photos/25387007@N02/8536051789/in/photostream/lightbox/ I want to find the distance between the upper and the middle object at pts on the extremes and the min distance between the two. Please help me to find the same. I do not want to use the distance between the two centroids. Thanks a lot

3 Comments

So to be clear you want the shortest distance between white pixels on the upper and middle objects? If so, first use bwboundaries() to find the outline of each object (i.e. the pixels on the edge). Then use a loop or cellfun or similar to calculate the distance between each boundary coordinate on one object and each boundary coordinate on the other object. Whichever pair has the smallest distance is your desired number.
Will it trace the curved boundaries vch r closest to each other? Coz they r the once i require. Or the dirction of the trace has to be given by us?
I am sorry but bwboundaries for the two objects gives two arrays of different dimensions.

Sign in to comment.

Answers (0)

Asked:

on 7 Mar 2013

Community Treasure Hunt

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

Start Hunting!