Linus
Linus

Reputation: 2819

OpenCV - Find skewed rectangle

I want to draw a "bounding box" around a skewed rectangle. I thought I could use the cvMinAreaRect2() function but it only handles the rotation, see this image:

enter image description here

Is there any function to solve this? If not, any ideas how to implement it?

Upvotes: 5

Views: 3374

Answers (1)

rwong
rwong

Reputation: 6162

Compute both MinAreaRect and ConvexHull. Then, for each of the four points found by MinAreaRect, find the corresponding nearest point in the convex hull.

Upvotes: 5

Related Questions