Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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 ??

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));

quad.rows));
    // Get transformation matrix
        cv::Mat transmtx = cv::getPerspectiveTransform(ecken, quad_pts);
cv::warpPerspective(src, quad, transmtx, quad.size(),1);

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 ??

Getting back to the original coordinates from a warped Image

I have four corners extracted from a image,

std::vector<cv::point2f>

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 ??

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 ??