1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

Merge pull request #23342 from n0099:#23335

Improve document of cv::RotatedRect for #23335 #23342

fix #23335

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
n0099
2023-05-03 19:15:53 +08:00
committed by GitHub
parent 3c76b33532
commit 868787c364
3 changed files with 10 additions and 2 deletions
@@ -38,6 +38,8 @@ int main()
waitKey(0);
//! [Algorithm]
const char * vertex_names[4] {"0", "1", "2", "3"};
//! [RotatedRect_demo]
Mat test_image(200, 200, CV_8UC3, Scalar(0));
RotatedRect rRect = RotatedRect(Point2f(100,100), Size2f(100,50), 30);
@@ -45,7 +47,10 @@ int main()
Point2f vertices[4];
rRect.points(vertices);
for (int i = 0; i < 4; i++)
{
line(test_image, vertices[i], vertices[(i+1)%4], Scalar(0,255,0), 2);
putText(test_image, vertex_names[i], vertices[i], FONT_HERSHEY_SIMPLEX, 1, Scalar(255,255,255));
}
Rect brect = rRect.boundingRect();
rectangle(test_image, brect, Scalar(255,0,0), 2);