Save the circle periphery after detecting the circle

1 回表示 (過去 30 日間)
KatherineL
KatherineL 2020 年 4 月 22 日
コメント済み: KatherineL 2020 年 4 月 24 日
Hello,
I have an image of three circles and I use regionprops() to detect them. I find the radii and centers of the circles, but that is not enough. To illustrate my circles I use viscircles(), but I would like to save the periphery of the circles for later use. I cannot see that regionprops() let me find this property of the circles, and I would like some tips or solution on this problem.
Regards, Katrine
  2 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 4 月 22 日
regionprops already gives the center and radius of the circle? How else do you want to save the periphery?
KatherineL
KatherineL 2020 年 4 月 22 日
I would like to save all the points on the periphery which I want to use later. For instance save the coordinates of the circle viscircles() draw and use them.

サインインしてコメントする。

回答 (2 件)

Ameer Hamza
Ameer Hamza 2020 年 4 月 22 日
You can calculate the coordinates on the periphery of a circle given the center and radius using these equations
center = [1 2];
radius = 1;
theta = linspace(0, 2*pi, 100);
x = radius*cos(theta);
y = radius*sin(theta);
plot(x,y);
  1 件のコメント
KatherineL
KatherineL 2020 年 4 月 24 日
Thank you - I got what I needed out from ConvexHull in regionprops().

サインインしてコメントする。


Image Analyst
Image Analyst 2020 年 4 月 22 日
Try bwboundaries:
boundaries = bwboundaries(binaryImage);
% Plot them.
hold on;
for k = 1 : length(boundaries)
thisBoundary = boundaries{k};
x = thisBoundary(:, 2);
y = thisBoundary(:, 1);
plot(x, y, 'r-', 'LineWidth', 2);
end
  1 件のコメント
KatherineL
KatherineL 2020 年 4 月 24 日
Thank you - I got what I needed out from ConvexHull in regionprops().

サインインしてコメントする。

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by