coordinates of the farthest point from centroid

2 Ansichten (letzte 30 Tage)
Suvidha
Suvidha am 17 Apr. 2013
boundaries = bwboundaries(pad);
thisBoundary = boundaries{1};
% Get the distances of the boundary pixels from the centroid.
distances = sqrt((thisBoundary(:,1) - a2).^2 + (thisBoundary(:,2) - b2).^2);
% Scan the boundary to find the pixel on it that is
% farthest from the centroid.
maxRadius = max(distances);
a2,b2 are centroid coordinates of the object named 'pad'
above code calculate the farthest distance. could anyone please tell what will be the coordinates of that point on the object boundary.

Akzeptierte Antwort

Ashish Uthama
Ashish Uthama am 17 Apr. 2013
Air code:
[maxRadius, maxRadiusIndex] = max(distances)
maxPointCoord = thisBoundary(maxRadiusIndex,:)
Look at the doc for the second output of max

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing and Computer Vision finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by