Getting back to the original coordinates from a warped Image
I have four corners extracted from a image,
std::vector<cv::Point2f> ecken;
ecken.push_back(corners[0]);
ecken.push_back(corners[size.height-1]);
ecken.push_back(corners[size.area()-size.height-1]);
ecken.push_back(corners[size.area()-1]);
they are warped in to a second image:
quad_pts.push_back(cv::Point2f(0, 0));
quad_pts.push_back(cv::Point2f(quad.cols, 0));
quad_pts.push_back(cv::Point2f(quad.cols, quad.rows));
quad_pts.push_back(cv::Point2f(0, quad.rows));
// Get transformation matrix
cv::Mat transmtx = cv::getPerspectiveTransform(ecken, quad_pts);
cv::warpPerspective(src, quad, transmtx, quad.size(),1);
I want to go back to the original image from the result that I get in quad, these what I've tried:
cv::Mat trans = cv::getPerspectiveTransform(quad_pts,ecken );
cv::perspectiveTransform(quad,test,trans);
and it didn't work !! any idea ??