Search code examples
pythonopencvdata-augmentation

The third column of cv2.getRotationMatrix2D


I have been learning how to rotate images without cropping recently. But I am slightly confused with the third column of cv2's getRotationMatrix2D. It returns a matrix of size 2 by 3.

enter image description here

Although my code is working based off Rotate an image without cropping in OpenCV in C++ and Python 2.7.3 + OpenCV 2.4 after rotation window doesn't fit Image, I would be glad and keen to know what exactly the third column of this transformation matrix does.


Solution

  • Thanks @Yunus for the documentation link. According to the documentation

    The transformation maps the rotation center to itself. If this is not the target, adjust the shift.

    which means M_rotation * vector_of_rotation_center = vector_of_rotation_center and the expression in the documentation is set such that the equation holds.

    The first two columns in the rotation matrix specifies the rotation transformation and scaling transformation; the third column is used to specify the translation transformation.