basicsr.utils.matlab_functions¶
- basicsr.utils.matlab_functions.calculate_weights_indices(in_length, out_length, scale, kernel, kernel_width, antialiasing)[source]¶
Calculate weights and indices, used for imresize function.
- Parameters:
in_length (int) – Input length.
out_length (int) – Output length.
scale (float) – Scale factor.
kernel_width (int) – Kernel width.
antialisaing (bool) – Whether to apply anti-aliasing when downsampling.
- basicsr.utils.matlab_functions.imresize(img, scale, antialiasing=True)[source]¶
imresize function same as MATLAB.
It now only supports bicubic. The same scale applies for both height and width.
- Parameters:
img (Tensor | Numpy array) – Tensor: Input image with shape (c, h, w), [0, 1] range. Numpy: Input image with shape (h, w, c), [0, 1] range.
scale (float) – Scale factor. The same scale applies for both height and width.
antialisaing (bool) – Whether to apply anti-aliasing when downsampling. Default: True.
- Returns:
Output image with shape (c, h, w), [0, 1] range, w/o round.
- Return type:
Tensor