Shortcuts

mmcv.image.rescale_size

mmcv.image.rescale_size(old_size: tuple, scale: Union[float, int, Tuple[int, int]], return_scale: bool = False)tuple[source]

Calculate the new size to be rescaled to.

Parameters
  • old_size (tuple[int]) – The old size (w, h) of image.

  • scale (float | int | tuple[int]) – The scaling factor or maximum size. If it is a float number or an integer, then the image will be rescaled by this factor, else if it is a tuple of 2 integers, then the image will be rescaled as large as possible within the scale.

  • return_scale (bool) – Whether to return the scaling factor besides the rescaled image size.

Returns

The new rescaled image size.

Return type

tuple[int]