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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)
