bbox2points
Convert rectangle to corner points list
Description
Examples
Define a bounding box.
bbox = [10,20,50,60];
Convert the bounding box to a list of four points.
points = bbox2points(bbox);
Define a rotation transformation.
theta = 10; tform = affine2d([cosd(theta) -sind(theta) 0; sind(theta) cosd(theta) 0; 0 0 1]);
Apply the rotation.
points2 = transformPointsForward(tform,points);
Close the polygon for display.
points2(end+1,:) = points2(1,:);
Plot the rotated box.
plot(points2(:,1),points2(:,2), '*-');
Input Arguments
Bounding box, specified as a 4-element vector, 5-element vector, M-by-4 matrix, or M-by-5 matrix.
Bounding Box | Example |
---|---|
For one or more rectangles, specify one of:
| |
![]() |
Data Types: single
| double
| int16
| int32
| uint16
| uint32
Output Arguments
Rectangle corner coordinates, returned as a 4-by-2 matrix of [x,y] coordinates, or a 4-by-2-by-M array of [x,y] coordinates. The output points for the rectangle are listed counterclockwise starting from the upper-left corner.
For a single input bounding box, the function returns the 4-by-2 matrix.
For multiple input bounding boxes, the function returns the 4-by-2-M array for M bounding boxes.
Data Types: single
| double
| int16
| int32
| uint16
| uint32
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2014b
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)