how get centroid contour distance every 1 degrees?
2 次查看(过去 30 天)
显示 更早的评论
I have an image and I already get the boundary and the weighted centroid of region of interest. I want to get the coordinate point of boundary at certain degrees. It starts from the fartest distance of center to edge and its counterclockwise. I have tried, using bwboundaries but the result is not appropriate with my goal. Can anyone help me about this? Thx for the help
this is my code
% BW = imread('fyc-00_1-006.png');
BW1 = bwareaopen(BW, 1000);
BW2 = imfill(BW1, 'holes');
s = regionprops(BW, 'centroid');
centroids = cat(1, s.Centroid);
[meanx,meany] = ait_centroid(BW2);
meanx;
meany;
[B,L,N,A] = bwboundaries(BW2);
imshow(BW2); hold on;
for j=1:N,
if(~sum(A(j,:)))
thisboundary = B{j};
plot(thisboundary(:,2),...
thisboundary(:,1),'r','LineWidth',2);
for l=find(A(:,j))'
thisboundary = B{l};
plot(thisboundary(:,2),...
thisboundary(:,1),'g','LineWidth',2);
end
end
end
plot(centroids(:,1), centroids(:,2), 'b*');
title('Binary Image', 'FontSize',20);
axis on;
x = thisboundary(:,2); %Column
y = thisboundary(:,1); %Rows
deltaY = y - meany;
deltaX = x - meanx;
distances = sqrt((x - meanx).^2 + (y - meany).^2);
<</matlabcentral/answers/uploaded_files/13965/pict.png>>
0 个评论
回答(2 个)
Image Analyst
2014-6-10
What is "ait_centroid"? It's not defined anywhere. Also, you're not calculating the angles of the boundary coordinates to the centroid or weighted centroid. You said you did it but didn't show how you did it. I don't see any reason why that should not work.
2 个评论
Image Analyst
2014-6-10
That's not exactly how I'd do it. First tell me what is a typical angle you'd want to find the boundary coordinate closest to? 20 degrees? 45 degrees? Something else?
LOKESH KAVULURU
2017-4-5
I also struck in this situation, i should calculate boundary for every 45 degrees
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Feature Detection and Extraction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!