![Case ID 03693723.jpeg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/230000/Case%20ID%2003693723.jpeg)
For a binay image, how to plot a circle by using the centroid of the white pixel region for any given radius.
1 回表示 (過去 30 日間)
古いコメントを表示
採用された回答
Vinai Datta Thatiparthi
2019 年 7 月 16 日
Hi!
It appears to me that you want to calculate the centroid of the white spot in your image, and using this centroid value as the center, plot a circle of any radius.
The first part of the question, i.e. finding the centroid of the circle can be evaluate as follows –
im = imread('figure.jpeg'); % Your figure
imBin = imbinarize(im);
imBin = imfill(imBin, 'holes');
BW = regionprops(logical(imBin), 'centroid');
imshow(imBin);
hold on;
plot(BW.Centroid(1),BW.Centroid(2),'bx')
The value of the centroid of this image is stored in the variable ‘BW’.
The output is -
![Case ID 03693723.jpeg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/230000/Case%20ID%2003693723.jpeg)
(I snipped this output to enhance readability)
Coming to the second part of your question, please refer to this link here to get the relevant steps to plotting a circle with a given center and radius.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Visual Exploration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!