imread
-
Description: Read an image based on different image formats using different methods. Supported formats and methods are as follows:
.heic
: Read usingread_heic_to_numpy
and convert toBGR
format..jpg
: Read usingjpgread
and convert toBGR
format.- Other formats: Read using
cv2.imread
and convert toBGR
format. - If
jpgread
returnsNone
, fall back to usingcv2.imread
.
-
Parameters
- path (
Union[str, Path]
): The path of the image to be read. - color_base (
str
): The color space of the image. If notBGR
, conversion will be done using theimcvtcolor
function. Default isBGR
. - verbose (
bool
): If set to True, a warning will be issued when the read image is None. Default is False.
- path (
-
Returns
- np.ndarray: Returns the numpy ndarray of the image if successful, otherwise returns None.
-
Example
import docsaidkit as D
img = D.imread('lena.png')