# Revision history [back]

Ok, when I run it, the results didn't match what you uploaded, but I did figure out how to make warpAffine function just like it.

Mat affine( 2, 3, CV_64F );
affine.at<double>( 0, 0 ) = a11;
affine.at<double>( 0, 1 ) = a12;
affine.at<double>( 0, 2 ) = ofsx;
affine.at<double>( 1, 0 ) = a21;
affine.at<double>( 1, 1 ) = a22;
affine.at<double>( 1, 2 ) = ofsy;
invertAffineTransform( affine, affine );
affine.at<double>( 0, 2 ) += output.cols / 2.0;
affine.at<double>( 1, 2 ) += output.rows / 2.0;

warpAffine( image, output, affine, Size( output.cols, output.rows ) );


warpAffine, unlike the function there, is capable of extrapolating past the edge of the image, so you may not need the return value. If you do, just use the BORDER_CONSTANT with a value outside your image range (say -999), then use the checkRange function with your image range to get the boolean value.