Removing Z rotation from homography matrix before warpPerspective
I'm trying to stitch together Images. I have homography matrix from findHomography() which I then pass to warpPerspective(). My issue is that all of the images are flat 2D ones, meaning they will never need any Z rotation. The findHomography(), however, thinks otherwise. How do I disable Z rotation in homography matrix?
Are you trying something like this?
@LBerger No, I'm actually doing the opposite of this. If my explanation is not clear, imagine taking a bunch of screenshots of this page. Now we want to stitch all of them together into one big image. All of our screenshots of this page are perfectly flat 2D and don't need any Z rotation. I have similar type image and I'm trying to achieve something like this. The issue is that findHomography() adds tiny bit of Z rotation which I want to get rid of.
I think it is not a homography you need but rather an affine transformation (
getAffineTransform()
). You can take a look at this also.Not sure to understand what you mean by no z-rotation. Using the screenshot example, there are no rotation at all, only translation. If the image is let's say 90° in-plane rotated, there is a rotation around the z-axis of the camera. Anyway, if your model is simple, you should estimate yourself the transformation matrix and pass it to
warpPerspective()
orwarpAffine()
.