Ask Your Question
1

Find skew of bounding box

asked 2014-06-05 00:16:28 -0600

Luek gravatar image

I am find a business card in an image and sometimes the card is slightly skewed, how can I find the skew of the bounding box of the card?

I am using the findContours() function to find the contours and then finding the largest contour. Storing the card in... cv::Rect bounding_rect;

How can I find the skew of boudning_rect? I have a function to deskew but I am having a hard time finding the skew.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-06-05 04:29:29 -0600

updated 2014-06-05 04:31:31 -0600

See the function fitEllipse which returns the rotated bounding box for a points set.

edit flag offensive delete link more
1

answered 2014-06-06 08:31:03 -0600

I suggest minAreaRect which gives you the smalles rotated rectangle that contains all given points. The result cv::RotatedRect has a member angle.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-06-05 00:16:28 -0600

Seen: 2,249 times

Last updated: Jun 06 '14