我已经计算出图像的质心,现在想要知道物体边界上距离质心最远点的坐标。质心最远点的坐标
我用下面的代码来计算最大距离。
boundaries = bwboundaries(pad);
thisBoundary = boundaries{1};
boundaryX=thisBoundary(:,1);
boundaryY=thisBoundary(:,2);
% Get the distances of the boundary pixels from the centroid.
distances= sqrt((boundaryX - a2).^2 + (boundaryY - b2).^2);
% Scan the boundary to find the pixel on it that is
% farthest from the centroid.
maxRadius = max(distances);
disp(maxRadius);
如果有人知道如何计算物体边界上距离质心的最远点坐标,距离质心最远点的距离在上面计算为maxRadius。这里a2,b2是对象'pad'的质心坐标。
请问如果有人知道是什么? – Jonas
这不是问题...? – Dan