Reputation: 570
I am using opencv warpPerspective
to generate images with different rotation to evaluate my feature point detection algorithm.
In homography matrix, the up-left 2x2 matrix is the rotation matrix, as referred here.
But the result is a rotation about the origin( the up-left corner), how can I modify the homography matrix to rotate the image about its center?
Regards.
Upvotes: 3
Views: 2217
Reputation: 14530
See this matrix
an affine transformation that translates and rotates, center is the center of rotation. To get a homography from this just need to add the last raw [ 0 0 1]
. You can use getRotationMatrix2D to compute this matrix, and then either use warpAffine
or form the homography and use warpPerspective
. Please let us know how it goes.
Upvotes: 4