0
votes

Say for 180 degree rotation between two images, even though technically after rotation the translation should be close to zero. The translation that I get from cv2.findhomography function using points from two 180 degree rotated images are way off by exactly the image size. Is there a mathematical way to estimate the correct translation vector (tx,ty) based on rotation

Also,does scale impact this translation value from homography matrix

1

1 Answers

1
votes

Homographies rotate images about the origin; i.e., (0, 0)---not the center of the image. What that means is that if you first translate the image so that the center of the image is at (0, 0), and then apply your rotation homography, it will rotate about the center. And then you can translate back. Since homographies compose, you can just generate a single homography for this which is just the combination of these three operations---translate, rotate, translate back.

I wrote a pretty in-depth answer on this previously that deals with "how to find the bounds of your image after applying an homography" (so it's more general than this question), which you can check out here. Additionally, that question spurred a GitHub repo for code to do exactly that, which you can check out here.