getPosition
Return current position of ROI object
getPosition is not recommended. Using the new ROIs, retrieve the
position of the ROI by accessing the value of Position property
instead. For more information, see Version History.
Syntax
Description
Input Arguments
Output Arguments
Position of the ROI object, returned as a numeric array. The shape of the array depends on the type of ROI object.
| ROI Object | Returned position |
|---|---|
imellipse | 4-element vector of the form [xmin ymin width
height], representing the size and position of
a bounding box around the ellipse. The initial size of the
bounding box is
width-by-height
pixels. The upper-left corner of the box is at the (x,y)
coordinate
(xmin,ymin). |
imfreehand | n-by-2 matrix. The two columns define the x- and y-coordinates, respectively, of the n points along the boundary of the freehand region. |
imline | 2-by-2 matrix of the form [x1 y1; x2
y2], representing the position of the two
endpoints of the line. |
impoint | 1-by-2 vector of the form [x
y]. |
impoly | n-by-2 matrix. The two columns define the x- and y-coordinates, respectively, of each of the n vertices. |
imrect | 4-element vector of the form [xmin ymin width
height]. The initial size of the rectangle is
width-by-height
pixels. The upper-left corner of the rectangle is at the
(x,y) coordinate
(xmin,ymin). |
Version History
Introduced in R2008aStarting in R2018b, a new set of ROI objects replaces the existing set of ROI objects. The new objects provide more functional capabilities, such as face color transparency. The new classes also support events that you can use to respond to changes in your ROI such as moving or being clicked. Although there are no plans to remove the old ROI objects at this time, switch to the new ROIs to take advantage of the additional capabilities and flexibility. For more information on creating ROIs using the new ROI functions, see Create ROI Shapes.
To retrieve the current position of the ROI, access the value of the
Position property of the ROI.
Update all instances of getPosition.
| Discouraged Usage | Recommended Replacement |
|---|---|
This example creates an ROI and uses
imshow('cameraman.tif');
h = imrect(gca,[10 10 100 100]);
pos = getPosition(h)
| Here is equivalent code, replacing the old ROI with a
new ROI object and then accessing the value of the
imshow('cameraman.tif'); h = drawrectangle(gca,'Position',[10 10 100 100]); pos = h.Position |
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)