0
我想繪製二進制圖像中的細胞周圍的橢圓形狀。到目前爲止,我嘗試了下面顯示的代碼在二進制圖像中的單元格周圍繪製橢圓。在代碼中,IBord是二進制圖像.Code在單元格周圍繪製橢圓形狀。如何在圖像中圍繞物體繪製橢圓形狀
s = regionprops(IBord, 'Orientation', 'MajorAxisLength', 'MinorAxisLength', 'Eccentricity', 'Centroid');
figure(2);
imshow(IBord)
phi = linspace(0,2*pi,50);
cosphi = cos(phi);
sinphi = sin(phi);
for k = 1:length(s)
xbar = s(k).Centroid(1);
ybar = s(k).Centroid(2);
a = s(k).MajorAxisLength/2;
b = s(k).MinorAxisLength/2;
theta = pi*s(k).Orientation/180;
R = [ cos(theta) sin(theta)
-sin(theta) cos(theta)];
xy = [a*cosphi;b*sinphi];
xy = R*xy;
X = xy(1,:) + xbar;
Y = xy(2,:) + ybar;
plot(X,Y,'r','LineWidth',2);
end
好心建議我如何修改這個代碼來繪製橢圓形(蛋狀)周圍細胞的二值圖像。
嘗試使用egg-functions,例如:http://www.mathematische-basteleien.de/eggcurves.htm或在這裏:http://www.geocities.jp/nyjp07/Egg/index_egg_E。 html – Adiel