cv3.transform.rotate90

cv3.transform.rotate90(img, inter=1, border=0, value=None)[source]

Rotate image by 90 degrees clockwise.

Parameters:
  • img (numpy.ndarray) – Input image.

  • inter (int or str, optional) – Interpolation method. Can be one of: ‘nearest’, ‘linear’, ‘area’, ‘cubic’, ‘lanczos4’ or OpenCV flags. Defaults to cv2.INTER_LINEAR.

  • border (int or str, optional) – Border type. Can be one of: ‘constant’, ‘replicate’, ‘reflect’, ‘wrap’, ‘default’ or OpenCV flags. Defaults to cv2.BORDER_CONSTANT.

  • value – Border color value for constant border type. Defaults to None.

Returns:

Rotated image.

Return type:

numpy.ndarray

Example

>>> import cv3
>>> import numpy as np
>>> # Create a simple image
>>> img = np.zeros((100, 100, 3), dtype=np.uint8)
>>> img[25:75, 25:75] = [255, 255, 255]  # White square
>>> # Rotate by 90 degrees
>>> rotated = cv3.rotate90(img)