| Contents | Index |
h = impoint
h = impoint(hparent)
p = impoint(hparent, position)
p = impoint(hparent, x, y)
p = impoint(..., param, val)
h = impoint begins interactive placement of a draggable point on the current axes. The function returns h, a handle to an impoint object. The point has a context menu associated with it that controls aspects of its appearance and behavior—see Interactive Behavior. Right-click on the point to access this context menu.
h = impoint(hparent) begins interactive placement of a point on the object specified by hparent. hparent specifies the HG parent of the point graphics, which is typically an axes but can also be any other object that can be the parent of an hggroup.
p = impoint(hparent, position) creates a draggable point on the object specified by hparent. position is a 1-by-2 array of the form [x y] that specifies the initial position of the point.
p = impoint(hparent, x, y) creates a draggable point on the object specified by hparent. x and y are both scalars that together specify the initial position of the point.
p = impoint(..., param, val) creates a draggable point , specifying parameters and corresponding values that control the behavior of the point. The following table lists the parameter available. Parameter names can be abbreviated, and case does not matter.
| Parameter | Description |
|---|---|
'PositionConstraintFcn' | Function handle fcn that is called whenever the point is dragged using the mouse. You can use this function to control where the point can be dragged. See the help for the setPositionConstraintFcn method for information about valid function handles. |
When you call impoint with an interactive
syntax, the pointer changes to a cross hairs
when over the image. Click
and drag the mouse to specify the position of the point, such as
. The following table
describes the interactive behavior of the point, including the right-click
context menu options.
| Interactive Behavior | Description |
|---|---|
| Moving the point. | Move the mouse pointer over the point. The mouse pointer changes
to a fleur shape
|
| Changing the color used to display the point. | Move the mouse pointer over the point. Right-click and select Set Color from the context menu and specify the color you want to use. |
| Retrieving the coordinates of the point. | Move the mouse pointer over the point. Right-click and select Copy Position from the context menu to copy a 1-by-2 array to the clipboard specifying the coordinates of the point [X Y]. |
The following lists the methods supported by the impoint object. Type methods impoint to see a complete list of all the methods.
See imroi for information.
See imroi for information.
See imroi for information.
pos = getPosition(h) returns the current position of the point h. The returned position, pos, is a two-element vector [x y].
See imroi for information.
See imroi for information.
See imroi for information.
See imroi for information.
See imroi for information.
setPosition(h,pos) sets the pointh to a new position. The new position, pos, has the form, [x y].
setPosition(h,new_x,new_y) sets the point h to a new position. new_x and new_y are both scalars that together specify the position of the point.
See imroi for information.
setString(h,s) sets a text label for the point h. The string, s, is placed to the lower right of the point.
See imroi for information.
If you use impoint with an axes that contains an image object, and do not specify a drag constraint function, users can drag the point outside the extent of the image and lose the point. When used with an axes created by the plot function, the axes limits automatically expand to accommodate the movement of the point.
Use impoint methods to set custom color, set a label, enforce a boundary constraint, and update position in title as point moves.
figure, imshow rice.png
h = impoint(gca,100,200);
% Update position in title using newPositionCallback
addNewPositionCallback(h,@(h) title(sprintf('(%1.0f,%1.0f)',h(1),h(2))));
% Construct boundary constraint function
fcn = makeConstrainToRectFcn('impoint',get(gca,'XLim'),get(gca,'YLim'));
% Enforce boundary constraint function using setPositionConstraintFcn
setPositionConstraintFcn(h,fcn);
setColor(h,'r');
setString(h,'Point label');Interactively place a point. Use wait to block the MATLAB command line. Double-click on the point to resume execution of the MATLAB command line.
figure, imshow('pout.tif');
p = impoint(gca,[]);
p = wait(p);imellipse | imfreehand | imline | impoly | imrect | imroi | makeConstrainToRectFcn

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |