1 | initial version |
i don't think, you need external libraries for this. opencv usually has it's polylines as a vector<Point>
.
// vector<Point> curve;
// 1. wrap a cv::Mat around it
Mat m(curve, false); // no copy
// 2. do some op on it, e.g. translation:
m += Point(10,10);
// scaling is a bit more tricky, because you probably want to scale
// towards the center of the curve, not to 0,0 in the image.
Rect r = boundingRect(m);
Point center = (r.x+r-w/2, r.y+r.h/2);
m -= center; // move it to 0,0
m *= 0.14; // scale with some factor
m += center; // back to orig. position