Shortcuts

mmcv.image.imresize

mmcv.image.imresize(img: ndarray, size: Tuple[int, int], return_scale: bool = False, interpolation: str = 'bilinear', out: ndarray | None = None, backend: str | None = None) Tuple[ndarray, float, float] | ndarray[source]

Resize image to a given size.

Parameters:
  • img (ndarray) – The input image.

  • size (tuple[int]) – Target size (w, h).

  • return_scale (bool) – Whether to return w_scale and h_scale.

  • interpolation (str) – Interpolation method, accepted values are “nearest”, “bilinear”, “bicubic”, “area”, “lanczos” for ‘cv2’ backend, “nearest”, “bilinear” for ‘pillow’ backend.

  • out (ndarray) – The output destination.

  • backend (str | None) – The image resize backend type. Options are cv2, pillow, None. If backend is None, the global imread_backend specified by mmcv.use_backend() will be used. Default: None.

Returns:

(resized_img, w_scale, h_scale) or resized_img.

Return type:

tuple | ndarray