draw circle on image
古いコメントを表示
I want to draw a circle with centre at centre of given image. Image get displayed but circle is missing. Without using hold on/off, a separate figure window shows circle, but i want the circle on the image. Plz correct the following code.
imshow(PICpng);
centx = x / 2;
centy = y / 2;
r = 10;
hold on;
theta = 0 : (2 * pi / 10000) : (2 * pi);
pline_x = r * cos(theta) + centx;
pline_y = r * sin(theta) + centy;
k = ishold;
plot(pline_x, pline_y, '*');
hold off;
5 件のコメント
Spandan Tiwari
2013 年 3 月 20 日
編集済み: Spandan Tiwari
2013 年 3 月 20 日
FYI, there's a function in the Image Processing Toolbox called VISCIRCLES which can be used for drawing circles. The basic syntax takes the centers and radii of the circles and draws them.
sangeeta
2013 年 3 月 21 日
Image Analyst
2013 年 3 月 21 日
編集済み: Image Analyst
2013 年 3 月 21 日
Spandan, does the help's "See also" connect to other toolboxes? If so, then the help for rectangle(), which people usually use to draw circles, should mention viscircle().
採用された回答
その他の回答 (1 件)
Muhammad Nauman Arshad
2020 年 2 月 19 日
ICpng = imread('peppers.png');
[rows columns numberOfColorChannels] = size(PICpng)
x = columns/2
y = rows/2
imshow(PICpng);
centx = x / 2;
centy = y / 2;
r = 60;
hold on;
theta = 0 : (2 * pi / 10000) : (2 * pi);
pline_x = r * cos(theta) + centx;
pline_y = r * sin(theta) + centy;
k = ishold;
plot(pline_x, pline_y, 'r-', 'LineWidth', 3);
hold off;
カテゴリ
ヘルプ センター および File Exchange で Particle & Nuclear Physics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

