File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -242,14 +242,15 @@ def loadimage(
242
242
return image
243
243
244
244
245
- def load_image (file_path : Path , img_type = cv2 .COLOR_BGR2GRAY ) -> np .ndarray :
245
+ def load_image (file_path : Path , imread_mode : int ) -> np .ndarray :
246
+ assert imread_mode in (cv2 .IMREAD_COLOR_RGB , cv2 .IMREAD_COLOR_BGR )
246
247
if file_path .name .endswith (".gif" ):
247
248
# patent issue? opencv cannot read GIF
248
- # TODO: Not consistent, img_type unused here
249
+ # TODO: Not consistent, imread_mode unused here
249
250
pil_image = Image .open (file_path )
250
251
image = np .array (pil_image )
251
252
else :
252
- image = cv2 .imread (file_path .as_posix (), img_type )
253
+ image = cv2 .imread (file_path .as_posix (), imread_mode )
253
254
if image is None : # TODO: wrong diag if format issue or any
254
255
raise Exception (f"Could not load: { file_path } " )
255
256
return image
You can’t perform that action at this time.
0 commit comments