Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

First, you need to add the flag WARP_INVERSE, because you are moving your image in the wrong direction.

Secondly, warpPerspective requires you to specify the size of the output, and the top left is always at (0,0). So if you warp things to negative pixel values, you have to alter the transformation to shift it in the x or y direction (.at<double>(0,2) and (1,2) respectively) so it is in the positive pixel ranges.