Ask Your Question

Revision history [back]

Without your code it is difficult to understand the problem but this code is correct : no exception

    Mat H(3, 3, CV_64FC1);
    Mat imgbgr = imread("g:/lib/opencv/samples/data/rubberwhale1.png", IMREAD_COLOR);
    H.at<double>(0, 0) = 0.766912;
    H.at<double>(0, 1) = 0.053191;
    H.at<double>(0, 2) = 637.961151;
    H.at<double>(1, 0) = -0.118426;
    H.at<double>(1, 1) = 0.965682;
    H.at<double>(1, 2) = 3.405685;
    H.at<double>(2, 0) = -0.000232;
    H.at<double>(2, 1) = 0.000019;
    H.at<double>(2, 2) = 1.000000;
    Mat result;
    warpPerspective(imgbgr, result, H, cv::Size(imgbgr.cols + imgbgr.cols, imgbgr.rows));