imageloading
imageloading ¶
Module for image loading
Classes¶
ImgShapeError ¶
Bases: Exception
Error when the image has the wrong shape
Functions¶
convert_to_3channel_img ¶
Converts an image (as np.ndarray) to a one with 3 channels
Parameters:
-
input_img
(ndarray
) –image object as np.ndarray
Returns:
-
ndarray
–image as np.ndarray with 3 channels
Source code in niceml/utilities/imageloading.py
load_img_uint8 ¶
load_img_uint8(
image_path,
file_system=None,
target_image_size=None,
interpolation=cv2.INTER_LINEAR,
)
Loads an image from arbitrary source ('file_system') and returns an uint8 np.ndarray
Parameters:
-
image_path
(Union[str, LocationConfig]
) –Path of image file to load
-
file_system
(Optional[AbstractFileSystem]
, default:None
) –Allow the function to be used with different file systems; default = local
-
target_image_size
(Optional[ImageSize]
, default:None
) –Target size of loaded image
-
interpolation
(int
, default:INTER_LINEAR
) –Interpolation of resizing
Returns:
-
ndarray
–Loaded image object with target size in uint8 format