imellipse() - Image Processing
h = imellipse begins interactive placement
of an ellipse on the current axes. The function returns h,
a handle to an imellipse object. The ellipse has
a context menu associated with it that controls aspects of its appearance
and behavior—see Interactive Behavior. Right-click on the line to access
this context menu.h = imellipse(hparent) begins
interactive placement of an ellipse on the object specified by hparent. hparent specifies
the HG parent of the ellipse graphics, which is typically an axes
but can also be any other object that can be the parent of an hggroup.h = imellipse(hparent, position) creates
a draggable ellipse on the object specified by hparent.
position is a four-element vector that specifies
the initial location of the ellipse in terms of a bounding rectangle. position has
the form [xmin ymin width height]. h = imellipse(...,param1, val1, ...) creates
a draggable ellipse, specifying parameters and corresponding values
that control the behavior of the ellipse. The following table lists
the parameter available. Parameter names can be abbreviated, and case
does not matter.ParameterValue
'PositionConstraintFcn'Function handle that is called whenever the mouse is
dragged. You can use this to control where the ellipse may be dragged.
See the help for the setPositionConstraintFcn method
for information about valid function handles.
Interactive BehaviorWhen you call imellipse with an interactive
syntax, the pointer changes to a cross hairs
when over an image. Click
and drag the mouse to specify the size and position of the ellipse.
The ellipse also supports a context menu that you can use to control
aspects of its appearance and behavior. The following figure illustrates
the ellipse with its context menu.
The following table lists the interactive behavior supported
by imellipse.Interactive BehaviorDescription
Moving the entire ellipse.Move the pointer inside the ellipse. The pointer changes to
a fleur shape
.
Click and drag the mouse to move the ellipse.
Resizing the ellipse.Move the pointer over a resizing handle on the ellipse. The
pointer changes to a double-ended arrow shape
. Click and drag the mouse
to resize the ellipse.
Changing the color used to display the ellipse. Move the pointer inside the ellipse. Right-click and select Set
Color from the context menu.
Retrieving the current position of the ellipse.Move the pointer inside the ellipse. Right-click and select Copy
Position from the context menu. imellipse copies
a four-element position vector [xmin ymin width height] to
the clipboard.
Preserving the current aspect ratio of the ellipse during resizing.Move the pointer inside the ellipse. Right-click and select Fix
Aspect Ratio from the context menu.
Deleting the ellipseMove the pointer inside the ellipse. Right-click and select Delete from
the context menu. To remove this option from the context menu, set
the Deletable property to false: h = imellipse();
h.Deletable = false;
MethodsEach imellipse object supports a number of
methods. Type methods imellipse to see a complete
list.addNewPositionCallback — Add new-position callback to ROI objectSee imroi for information.createMask — Create mask within imageSee imroi for information.delete — Delete ROI objectSee imroi for information.getColor — Get color used to draw ROI objectSee imroi for information.getPosition — Return current position of ellipseSee imrect for information.getPositionConstraintFcn — Return function handle to
current position constraint functionSee imroi for information.getVertices — Return vertices on perimeter of ellipsevert = getVertices(h) returns a set of vertices
which lie along the perimeter of the ellipse h. vert is
a N-by-2 array.removeNewPositionCallback — Remove new-position callback from ROI object.See imroi for information.resume — Resume execution of MATLAB command lineSee imroi for information.setColor — Set color used to draw ROI objectSee imroi for information.setConstrainedPosition — Set ROI object to new positionSee imroi for information.setFixedAspectRatioMode — Control whether aspect ratio
preserved during resizeSee imrect for information.setPosition — Set ellipse to new positionSee imrect for information.setPositionConstraintFcn — Set position constraint function
of ROI object.See imroi for information.setResizable — Set resize behavior of ellipseSee imrect for information.wait — Block MATLAB command line until ROI creation
is finishedvert = wait(h) blocks execution of the MATLAB
command line until you finish positioning the ROI object h.
You indicate completion by double-clicking on the ROI object. The
returned vertices, vert, is of the form returned
by the getVertices method.
Syntax
h = imellipseh = imellipse(hparent)h = imellipse(hparent, position)h = imellipse(...,param1, val1, ...)
Example
figure, imshow('cameraman.tif');
h = imellipse(gca, [10 10 100 100]);
addNewPositionCallback(h,@(p) title(mat2str(p,3)));
fcn = makeConstrainToRectFcn('imellipse',get(gca,'XLim'),get(gca,'YLim'));
setPositionConstraintFcn(h,fcn);
Output / Return Value
Limitations
Alternatives / See Also
Reference