imread
-
Description: Reads an image using different methods based on the image format. Supported formats are as follows:
.heic
: Usesread_heic_to_numpy
to read and converts toBGR
format..jpg
: Usesjpgread
to read and converts toBGR
format.- Other formats: Uses
cv2.imread
to read and converts toBGR
format. - If
jpgread
returnsNone
,cv2.imread
will be used as a fallback.
-
Parameters:
- path (
Union[str, Path]
): The path to the image file. - color_base (
str
): The color space of the image. If it is notBGR
, the function will convert it using theimcvtcolor
function. Default isBGR
. - verbose (
bool
): If set toTrue
, a warning will be issued when the image read result isNone
. Default isFalse
.
- path (
-
Return value:
- np.ndarray: Returns the image as a NumPy ndarray if successful, otherwise returns
None
.
- np.ndarray: Returns the image as a NumPy ndarray if successful, otherwise returns
-
Example:
import capybara as cb
img = cb.imread('lena.png')