Ask Your Question

Revision history [back]

You first need to use the function cv::rotatedRect::boundingRect which returns you a rotatedRect object from which you can derive the angle as a float parameter!

You first need to use the function cv::rotatedRect::boundingRect which returns you a rotatedRect object from which you can derive the angle as a float parameter!

You first need to use the function cv::rotatedRect::boundingRect which returns you a rotatedRect object from which you can derive the angle as a float parameter!

UPDATE

Ow excuse me :) What you should do is rotate the image over the angle to obtain a rectangular bounding box and then crop it out. That would be the fastest way. Rotating an image around a point is illustrated here, which is a Python tutorial but the idea in C++ is exactly the same.