-2

I am trying to implement in python the following C++ code

cv::RotatedRect box1(center, cv::Size(a_axis, b_axis), 0);
cv::ellipse(*img, box1, cv::Scalar(255, 255, 0), 1);

I know that ellipse would be

   image = cv.ellipse(image, box, (255,255,0), 1)

but how do I get the box (RotatedRect)?

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
KansaiRobot
  • 7,564
  • 11
  • 71
  • 150
  • Are you asking about `RotatedRect` in general or about `RotatedRect` with `angle=0` as in your C++ code sample? – Rotem Jan 01 '22 at 09:24
  • 1
    In Python it's a tuple of the 3 components you pass to the `RotatedRect` in C++, in the same order. Or just use the [overload of `cv.ellipse`](https://docs.opencv.org/4.5.5/d6/d6e/group__imgproc__draw.html#ga28b2267d35786f5f890ca167236cbc69), which instead of `RotatedRect` takes the 3 components separately.... – Dan Mašek Jan 01 '22 at 10:31

1 Answers1

0

RotatedRect implementation works properly only on c++. Have a look at this question. Also have a look at the answers and comments of this question for more discussion on the workaround.

Abhi25t
  • 3,703
  • 3
  • 19
  • 32