How to draw circle with imellipse?

6 visualizaciones (últimos 30 días)
Steven
Steven el 18 de En. de 2014
Editada: Image Analyst el 18 de Feb. de 2019
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

Respuesta aceptada

Image Analyst
Image Analyst el 18 de En. de 2014
  2 comentarios
Image Analyst
Image Analyst el 18 de En. de 2014
Editada: Image Analyst el 18 de En. de 2014
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 el 18 de En. de 2014
Editada: Steven el 26 de Abr. de 2016
Thanks

Iniciar sesión para comentar.

Más respuestas (1)

Tim Jackman
Tim Jackman el 25 de Sept. de 2018
In R2018b you can create a circular ROI with the drawcircle function.
  3 comentarios
Matt J
Matt J el 18 de Feb. de 2019
Editada: Matt J el 18 de Feb. de 2019
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 el 18 de Feb. de 2019
Editada: Image Analyst el 18 de Feb. de 2019
It does have a 'DrawingArea' option to restrict the drawing area to what you specify.
Have you tried waitfor()?

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by