Minimal area rectangle for multiple contours
I have a case with several contours
std::vector<std::vector<cv::Point>> contours;
I want to get the smallest area rectangle RotatedRect
containing all these contours. I have tried minAreaRect()
but it returns an exception (probably because I pass it more than one contour).
What would be the best way of getting the minimal area rectangle when you're dealing with more than one contour?
You want a rotated rectangle containing all the contours in the vector, our just a bounding box enclosing all the contours?
A rotated rectangle, but bonus points if the answer includes bounding box as well! :-)