Repository: opencv
Issue: In certain cases, MinAreaRect raises an error. (orientation != 0 in function 'rotatingCalipers')
Labels: bug,category: imgproc,affected: 3.4

<!--
If you have a question rather than reporting a bug please go to https://forum.opencv.org where you get much faster responses.
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).

This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
-->

##### System information (version)
- OpenCV => 4.5.1.48, 4.5.2.52, 4.5.2.54, 4.5.3.56, 4.5.4.58, 4.5.4.60, 4.5.5.62 **(4.4.0.46 doesn't have an issue.)**
- Operating System / Platform => Ubuntu 20.04
- Compiler => :grey_question: (I just install opencv via pip)
- Python 3.9.5

##### Detailed description
In certain cases, MinAreaRect raises an error.
`error: OpenCV(4.5.2) /tmp/pip-req-build-qxrf2chl/opencv/modules/imgproc/src/rotcalipers.cpp:166: error: (-215:Assertion failed) orientation != 0 in function 'rotatingCalipers'`

##### Steps to reproduce
```python
In [1]: import numpy as np

In [2]: import cv2

In [3]: b = [[188.8991,    12.400669],
   ...:  [ 80.64467,  -49.644814],
   ...:  [469.59897,  173.28242 ],
   ...:  [690.4597,   299.86768 ]]

In [4]: b = np.array(b, dtype=np.float32)

In [5]: rect = cv2.minAreaRect(b)
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-5-635d0d3918d6> in <module>
----> 1 rect = cv2.minAreaRect(b)

error: OpenCV(4.5.2) /tmp/pip-req-build-qxrf2chl/opencv/modules/imgproc/src/rotcalipers.cpp:166: error: (-215:Assertion failed) orientation != 0 in function 'rotatingCalipers'
```


##### Issue submission checklist

 - [x] I report the issue, it's not a question
   <!--
   OpenCV team works with forum.opencv.org, Stack Overflow and other communities
   to discuss problems. Tickets with questions without a real issue statement will be
   closed.
   -->
 - [x] I checked the problem with documentation, FAQ, open issues,
       forum.opencv.org, Stack Overflow, etc and have not found any solution
   <!--
   Places to check:
   * OpenCV documentation: https://docs.opencv.org
   * FAQ page: https://github.com/opencv/opencv/wiki/FAQ
   * OpenCV forum: https://forum.opencv.org
   * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
   * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
   -->
 - [x] I updated to the latest OpenCV version and the issue is still there
   <!--
   master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
   OpenCV team supports only the latest release for each branch.
   The ticket is closed if the problem is not reproduced with the modern version.
   -->
 - [x] There is reproducer code and related data files: videos, images, onnx, etc
   <!--
   The best reproducer -- test case for OpenCV that we can add to the library.
   Recommendations for media files and binary files:
   * Try to reproduce the issue with images and videos in opencv_extra repository
     to reduce attachment size
   * Use PNG for images, if you report some CV related bug, but not image reader
     issue
   * Attach the image as an archive to the ticket, if you report some reader issue.
     Image hosting services compress images and it breaks the repro code.
   * Provide ONNX file for some public model or ONNX file with random weights,
     if you report ONNX parsing or handling issue. Architecture details diagram
     from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
   -->