How to rotate a bounding box at a location

6 ビュー (過去 30 日間)
Elysi Cochin
Elysi Cochin 2014 年 8 月 5 日
コメント済み: Elysi Cochin 2014 年 8 月 6 日
How to rotate an obtained bounding box at a location.... and also get a bounding box opposite to it....
the link below shows how i want the bounding boxes...
Below shows the code i used to draw boundingbox...
boundingBox = bb(boundBox, itr);
x1 = boundingBox(1);
y1 = boundingBox(2);
x2 = x1 + boundingBox(3) - 1;
y2 = y1 + boundingBox(4) - 1;
verticesX = [x1 x2 x2 x1 x1];
verticesY = [y1 y1 y2 y2 y1];
verticesXY = [verticesX; verticesY];
plot(verticesX, verticesY, 'r-', 'LineWidth', 2);
this is the vertex i got
verticesXY =
40.5000 103.5000 103.5000 40.5000 40.5000
304.0000 304.0000 367.0000 367.0000 304.0000
please help me do the rotation and locate the opposite boundingbox also...

採用された回答

Supreeth Subbaraya
Supreeth Subbaraya 2014 年 8 月 5 日
You can perform the rotation and translation using the functions hgtransform and makehgtform. The documentation and the examples can be found here.
Also I have modified your code and attached as bbCode.m. The code performs a basic version of the operations you asked for. You have to assign values to the variables opp_side_x, opp_side_y (Opposite side x and y coordinates) and rot_angle_rad (Rotation Angle in radians).
  1 件のコメント
Elysi Cochin
Elysi Cochin 2014 年 8 月 6 日
i'll try on it... thank you so much for your reply....

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeObject Containers についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by