필터 지우기
필터 지우기

How to draw circle with imellipse?

조회 수: 6 (최근 30일)
Steven
Steven 2014년 1월 18일
편집: Image Analyst 2019년 2월 18일
Hi
I want to draw a circle with imellipse. I used something like:
AA = imellipse(gca,[xmin ymin radius radius]);
but I can only specify the xmin and ymin of the circle, while I want to specify the center.
How can I do so?
Thanks!
Steven

채택된 답변

Image Analyst
Image Analyst 2014년 1월 18일
  댓글 수: 2
Image Analyst
Image Analyst 2014년 1월 18일
편집: Image Analyst 2014년 1월 18일
If you really want to do it with imellipse, you can just compute the xmin and ymin from the diameter. By the way, imellipse takes width and height (diameter) not radius.
diameter = 10;
radius = diameter / 2;
xCenter = 60;
yCenter = 30;
xMin= xCenter - radius;
yMin = yCenter - radius;
hEllipse = imellipse(gca,[xMin, yMin, diameter, diameter]);
% Plot center
hold on;
plot(xCenter, yCenter, 'r+', 'LineWidth', 5, 'MarkerSize', 20);
grid on;
Steven
Steven 2014년 1월 18일
편집: Steven 2016년 4월 26일
Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Tim Jackman
Tim Jackman 2018년 9월 25일
In R2018b you can create a circular ROI with the drawcircle function.
  댓글 수: 3
Matt J
Matt J 2019년 2월 18일
편집: Matt J 2019년 2월 18일
Unfortunately, drawcircle doesn't seem to come with a wait method letting you finalize the position of the circle, nor either features of the imroi classes like positionConstraintFcns.
Image Analyst
Image Analyst 2019년 2월 18일
편집: Image Analyst 2019년 2월 18일
It does have a 'DrawingArea' option to restrict the drawing area to what you specify.
Have you tried waitfor()?

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by