find the distance from one pixel to all the pixel in image

2 views (last 30 days)
hello i have the one edge of image and also have centroid pixel, now i want to find the distance from centroid to all the pixel in edge. and want to store in some variable. now next wat i want to do i want to find exactly the another edge which have the distance from first edge is 1. so plz inform me that what is the code for it and plz explain me with example.

Accepted Answer

Walter Roberson
Walter Roberson on 27 Mar 2014
Eucdistance = sqrt((EdgeX - CentroidX).^2 + (EdgeY - CentroidY).^2);
The edge of "exactly" distance 1 from the first edge is going to depend upon how the first edge is specified, and is going to depend upon whether the edge is certain to be horizontal, or certain to be vertical, or might be slanted. If it might be slanted then defining by a pixel list runs into some problems with definitions of distance.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!