1 | initial version |
to combine them, push all their points into a vector, then get a new minAreaRect from that:
RotatedRect rr1, rr2; // your rects.
vector<Point2f> allpts;
Point2f p1[4];
rr1.points(p1);
allpts.push_back(p1[0]);
allpts.push_back(p1[1]);
allpts.push_back(p1[2]);
allpts.push_back(p1[3]);
Point2f p2[4];
rr2.points(p2);
allpts.push_back(p2[0]);
allpts.push_back(p2[1]);
allpts.push_back(p2[2]);
allpts.push_back(p2[3]);
RotatedRect final = minAreaRect(allpts);