Shortcuts

mmcv.image.imrotate

mmcv.image.imrotate(img: ndarray, angle: float, center: Tuple[float, float] | None = None, scale: float = 1.0, border_value: int = 0, interpolation: str = 'bilinear', auto_bound: bool = False, border_mode: str = 'constant') ndarray[source]

Rotate an image.

Parameters:
  • img (np.ndarray) – Image to be rotated.

  • angle (float) – Rotation angle in degrees, positive values mean clockwise rotation.

  • center (tuple[float], optional) – Center point (w, h) of the rotation in the source image. If not specified, the center of the image will be used.

  • scale (float) – Isotropic scale factor.

  • border_value (int) – Border value used in case of a constant border. Defaults to 0.

  • interpolation (str) – Same as resize().

  • auto_bound (bool) – Whether to adjust the image size to cover the whole rotated image.

  • border_mode (str) – Pixel extrapolation method. Defaults to ‘constant’.

Returns:

The rotated image.

Return type:

np.ndarray