- cv2.imread
cv2.imread(fileName, flag)
- filename: The path to the image file.
- flag: The flag specifies the way how the image should be read, there are 3 options.
- cv2.IMREAD_COLOR – It specifies to load a color image. Any transparency of image will be neglected, default. Alternatively, we can pass integer value 1.
- cv2.IMREAD_GRAYSCALE – It specifies to load an image in grayscale mode. Alternatively, we can pass integer value 0.
- cv2.IMREAD_UNCHANGED – It specifies to load an image as such including alpha channel. Alternatively, we can pass integer value -1.
def load_image(path: str) -> np.ndarray:
cv_img = cv2.imread(path,1).astype('uint8')
return cv_img
'Basic Python' 카테고리의 다른 글
StringIO (0) | 2024.05.03 |
---|---|
argparse (0) | 2023.12.13 |
Logger, Handler, Filter, Formatter (0) | 2023.12.08 |
str VS repr (0) | 2023.11.16 |
getattr (0) | 2023.11.15 |