OpenCV Image Rotation

The image can be rotated in various angles (90,180,270 and 360). OpenCV calculates the affine matrix that performs affine transformation, which means it does not preserve the angle between the lines or distances between the points, although it preserves the ratio of distances between points lying on the lines.

The syntax of the rotate image is the following:

Parameters:

  • center: It represents the center of the image.
  • angle: It represents the angle by which a particular image to be rotated in the anti-clockwise direction.
  • rotated: ndarray that holds the rotated image data.
  • scale: The value 1.0 is denoted that the shape is preserved. Scale the image according to the provided value.

Example-1

Output:

OpenCV Image Rotation




Latest Courses