Ask Your Question

Revision history [back]

How do I convert vector<point> to vector<point2f>

I have vector<Point> contour and want to convert it to vector<Point2f>.

What seems to work is

vector<Point2f> contour2f; 
for (int j = 0; j < contour.size(); j++) {
    contour2f.push_back((Point2f)contour[j]); 
}

Is there a better way of doing this (more elegant)?