COSIE.image_preprocessing.rescale_image

rescale_image(img, scale)[source]

Rescale an image by a given scale factor using skimage.transform.rescale.

Parameters

imgnp.ndarray

Input image array. Can be either a 2D grayscale image of shape (H, W), or a 3D color image of shape (H, W, C).

scalefloat

Rescaling factor. The same scale is applied to both height and width dimensions. If the input is 3D, the channel dimension is preserved.

Returns

imgnp.ndarray

The rescaled image array. The output values are kept in the original range of the input (preserve_range=True).