I need to extract a detected rectangle from an image. Rectangles are rotated in arbitrary degrees which are unknown. I have seen this post: How to straighten a rotated rectangle
But there are two problems:
- How to calculate 'theta', which is solvable mathematically.
- The code snippet in this post works only for
cv
notcv2
.
Anybody have better solutions than this post? A solution completely developed in cv2
I have used RotateRect function. In both cases I have detected the rectangles and draw them. The problem is the angle. In both cases angels are detected negative. at least one of them should be positive. That,s why I can not rotate them correctly according to link. Please take a look at the photos I attached to the question.