perspectiveTransform on contours?
Hi all,
I've got a contour for a flat, irregular shape with ~ten, 2D, points. I'd like to project just that contour, not the whole image, into a normal view and then find area, etc.
I know the contour is OK because drawContours has the expected result. The rotation matrix, Rot3D, works with warpPerspective on the full image (I play with the rotations for the background in a calibration step, then try to use the same rotation matrix here. It is a (3, 3, CV_32FC1) ).
I simplified everything to this code: `
////this builds a contour-like structure for testing...
vector<Point2f> foo = { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 1, 0 } };
vector<vector<Point2f>> bar;
bar = { foo, foo};
//which ought to work with this...
contours1.resize(bar.size());
for (int i = 0; i < bar.size(); i++) //for each vector of points in the list...
perspectiveTransform(bar[i], contours1[i], Rot3D);//rotate them.
` which fails an assertion check:
No clue what that means...contours1 is a vector<vector<point>> ... Douh! could that be it...
OK, findContours produces <point> (i.e., two int), perspectiveTransform requires <point2f>