3

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.

Community
  • 1
  • 1
beaver
  • 550
  • 1
  • 9
  • 23

1 Answers1

4

See this matrix

enter image description here

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.

fireant
  • 14,080
  • 4
  • 39
  • 48