Ask Your Question

Revision history [back]

The matrix in parameter is working like a set of point (you could use a vector of point to init a matrix).

std::vector< cv::Point2f > mySrcPoints;
... // fill the vector
cv::Mat dst;
cv::warpPerspective( cv::Mat( mySrcPoints ), dst, warpMatrix, dst.size(), CV_WRAP_INVERSE_MAP );
// To get the points
for( int r = 0 ; r < dst.rows ; ++r )
{
    for( int c = 0 ; c < dst.cols ; ++c )
    {
        std::cout << "Point at " << r << "," << c << " is wrap at " << dst.at< float >( r, c ) << std::endl;
    }
}

This is working even if you don't set the input without a vector. But the destination point matrix is of the same type as the input matrix, don't forget that when you use the template accessor .at< TYPE >( row, col )!