Ask Your Question

Revision history [back]

I have met the same problem, I am using opencv 2.4.6.0 and visual studio professional 2012 The only solution I found for my code is if you have an CV_32FC1 type use warp_mat = Mat::zeros(2, 3, CV_32FC1);

    cout << "Warp_mat = " <<endl;
    for ( int i = 0; i <3; i++)
    {
        cout<<" " << warp_mat.at<float>(0, i) ;
    }
    cout << " " <<endl;
    for ( int i = 0; i <3; i++)
    {
            cout<<" " << warp_mat.at<float>(1, i) ;
    }
    cout << " " <<endl;

That was at the initialization stage, later after getting the affine the function changed it to a cv_64F therefore you cannot use that code but instead you have to use the following cout << "Warp_mat = " <<endl; for="" (="" int="" i="0;" i="" &lt;3;="" i++)="" {="" cout&lt;&lt;"="" "="" &lt;&lt;="" warp_mat.at<double="">(0, i) ; } cout << " " <<endl; for="" (="" int="" i="0;" i="" &lt;3;="" i++)="" {="" cout&lt;&lt;"="" "="" &lt;&lt;="" warp_mat.at<double="">(1, i) ; } cout << " " <<endl;< p="">

I have met the same problem, I am using opencv 2.4.6.0 and visual studio professional 2012 The only solution I found for my code is if you have an CV_32FC1 type use warp_mat = Mat::zeros(2, 3, CV_32FC1);

    cout << "Warp_mat = " <<endl;
    for ( int i = 0; i <3; i++)
    {
        cout<<" " << warp_mat.at<float>(0, i) ;
    }
    cout << " " <<endl;
    for ( int i = 0; i <3; i++)
    {
            cout<<" " << warp_mat.at<float>(1, i) ;
    }
    cout << " " <<endl;

That was at the initialization stage, later after getting the affine the function changed it to a cv_64F therefore you cannot use that code but instead you have to use the following

    cout << "Warp_mat = " <<endl; for="" (="" int="" i="0;" i="" &lt;3;="" i++)="" {="" cout&lt;&lt;"="" "="" &lt;&lt;="" warp_mat.at<double="">(0, <<endl;
    for ( int i = 0; i <3; i++)
    {
            cout<<" " << warp_mat.at<double>(0, i) ;
     }
        cout << " " <<endl; for="" (="" int="" i="0;" i="" &lt;3;="" i++)="" {="" cout&lt;&lt;"="" "="" &lt;&lt;="" warp_mat.at<double="">(1, cout << " " <<endl;
    for ( int i = 0; i <3; i++)
    {
        cout<<" " << warp_mat.at<double>(1, i) ;
     }
        cout << " " <<endl;< p="">

cout << " " <<endl;