diff --git a/modules/core/include/opencv2/core/types.hpp b/modules/core/include/opencv2/core/types.hpp index 8a0886f2c8..8e56d5dd93 100644 --- a/modules/core/include/opencv2/core/types.hpp +++ b/modules/core/include/opencv2/core/types.hpp @@ -558,7 +558,7 @@ public: //! returns the minimal up-right integer rectangle containing the rotated rectangle CV_WRAP Rect boundingRect() const; //! returns the minimal (exact) floating point rectangle containing the rotated rectangle, not intended for use with images - Rect_ boundingRect2f() const; + CV_WRAP Rect2f boundingRect2f() const; //! returns the rectangle mass center CV_PROP_RW Point2f center; //! returns width and height of the rectangle diff --git a/modules/python/test/test_misc.py b/modules/python/test/test_misc.py index 51ece30dc6..bcd3152699 100644 --- a/modules/python/test/test_misc.py +++ b/modules/python/test/test_misc.py @@ -608,6 +608,14 @@ class Arguments(NewOpenCVTests): _, inter_pts = cv.rotatedRectangleIntersection(rect1, rect2) self.assertLess(np.max(np.abs(inter_pts.reshape(-1, 2) - pts)), 1e-4) + def test_result_rotated_rect_boundingRect2f(self): + center = (0, 0) + size = (10, 10) + angle = 0 + gold_box = (-5.0, -5.0, 10.0, 10.0) + rect1 = cv.RotatedRect(center, size, angle) + bbox = rect1.boundingRect2f() + self.assertEqual(gold_box, bbox) def test_parse_to_rotated_rect_not_convertible(self): for not_convertible in ([], (), np.array([]), (123, (45, 34), 1), {1: 2, 3: 4}, 123,