Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Homography transformation + scale

I have a transformation between 2 images. I've computed the homography matrix. Applying this mastrix with warpPerspective works well.

Now, before to apply warpPerspective, I want to resize the image by a factor 2 (in x and y) with resize(in, out, out.size(), 0, 0, interpolation); So I need to update H if I want the transformation be alright. I thought that doing

PSEUDO-CODE:
resize(in, out, out.size(), 0, 0, OPENCV_NEAREST) --> scaling by 2
H02 * 2;
H12 * 2;
warpPespective(in, out, H, OPENCV_BILINEAR)

was enough, but apparently not.

Doing it in one pass would be easy:

PSEUDO-CODE:
H02 *= 2;
H12 *= 2;

H00 *= 2;
H01 *= 2;
H10 *= 2;
H11 *= 2;

warpPespective(in, out, H, OPENCV_NEAREST);

But I don't want it because I want a different interpolation algorithm between the scale and the warpPespective. How the H transformation should be to match what I want ?