qualitylib.tools.resize.imresize

imresize(I, scalar_scale=None, method='bicubic', output_shape=None, mode='vec')[source]

Resize image given scale factor or output shape

Parameters:
  • I (ndarray) – Input image

  • scalar_scale (Optional[float]) – Scalar scale factor (optional). Defaults to None - resized to output_shape.

  • method (str) – Interpolation method. Defaults to ‘bicubic’.

  • output_shape (Optional[Tuple[int]]) – Output shape (optional). Defaults to None - inferred from scalar_scale.

  • mode (str) – Resize mode - ‘iter’ (iterative) or ‘vec’ (vectorized). Defaults to ‘vec’.

Raises:
  • ValueError – If kernel method is neither ‘bicubic’ nor ‘bilinear’.

  • ValueError – If both scalar_scale and output_shape are None.

  • ValueError – If both scalar_scale and output_shape are provided.

Return type:

ndarray

Returns:

Resized image