Question

I calculate the homography matrix of an image using OpenCV's findHomography and then I warp the image using warpPerspective function. Now I want to use the same homography matrix for a scaled version of the image (the scaled version has the same aspect ratio, and the image is scaled around it's center). The problem is similar to "opencv update homography matrix to fit on an image double the size" which does not seem to have a correct answer.

Is it possible to apply a scaling factor to an existing homography matrix?

Regards

Was it helpful?

Solution

If you want to apply the same deformation but on a smaller image, then you do not need to change the homography.

If you want to change the scale factor of the homography, you can obtain the new homography matrix by multiplying the previous one on the right by: [ 1/lambda 0 0; 0 1/lambda 0; 0 0 1 ] (in row-major order), where lambda is the desired scale factor.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top