how get centroid contour distance every 1 degrees?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Image Analyst
el 10 de Jun. de 2014
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 comentarios
Image Analyst
el 10 de Jun. de 2014
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
el 5 de Abr. de 2017
I also struck in this situation, i should calculate boundary for every 45 degrees
0 comentarios
Ver también
Categorías
Más información sobre Feature Detection and Extraction en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!