MATLAB: Find the distance from one pixel to all the pixel in image

distance messure from one pixel to many more pixelMATLAB

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.

Best Answer

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.
Related Question