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

Merge pull request #23702 from dkurt:py_rotated_rect

Python binding for RotatedRect #23702

### Pull Request Readiness Checklist

related: https://github.com/opencv/opencv/issues/23546#issuecomment-1562894602

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:
Dmitry Kurtaev
2023-06-22 15:09:53 +03:00
committed by GitHub
parent 60848519b5
commit 22b747eae2
5 changed files with 71 additions and 10 deletions
+11 -8
View File
@@ -527,23 +527,23 @@ The sample below demonstrates how to use RotatedRect:
@sa CamShift, fitEllipse, minAreaRect, CvBox2D
*/
class CV_EXPORTS RotatedRect
class CV_EXPORTS_W_SIMPLE RotatedRect
{
public:
//! default constructor
RotatedRect();
CV_WRAP RotatedRect();
/** full constructor
@param center The rectangle mass center.
@param size Width and height of the rectangle.
@param angle The rotation angle in a clockwise direction. When the angle is 0, 90, 180, 270 etc.,
the rectangle becomes an up-right rectangle.
*/
RotatedRect(const Point2f& center, const Size2f& size, float angle);
CV_WRAP RotatedRect(const Point2f& center, const Size2f& size, float angle);
/**
Any 3 end points of the RotatedRect. They must be given in order (either clockwise or
anticlockwise).
*/
RotatedRect(const Point2f& point1, const Point2f& point2, const Point2f& point3);
CV_WRAP RotatedRect(const Point2f& point1, const Point2f& point2, const Point2f& point3);
/** returns 4 vertices of the rotated rectangle
@param pts The points array for storing rectangle vertices. The order is _bottomLeft_, _topLeft_, topRight, bottomRight.
@@ -552,16 +552,19 @@ public:
rectangle.
*/
void points(Point2f pts[]) const;
CV_WRAP void points(CV_OUT std::vector<Point2f>& pts) const;
//! returns the minimal up-right integer rectangle containing the rotated rectangle
Rect boundingRect() const;
CV_WRAP Rect boundingRect() const;
//! returns the minimal (exact) floating point rectangle containing the rotated rectangle, not intended for use with images
Rect_<float> boundingRect2f() const;
//! returns the rectangle mass center
Point2f center;
CV_PROP_RW Point2f center;
//! returns width and height of the rectangle
Size2f size;
CV_PROP_RW Size2f size;
//! returns the rotation angle. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle.
float angle;
CV_PROP_RW float angle;
};
template<> class DataType< RotatedRect >