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)