Open an image or a depthmap with opencv-python.
(path, options=cv2.IMREAD_COLOR)
| 30 | |
| 31 | |
| 32 | def imread_cv2(path, options=cv2.IMREAD_COLOR): |
| 33 | """ Open an image or a depthmap with opencv-python. |
| 34 | """ |
| 35 | if path.endswith(('.exr', 'EXR')): |
| 36 | options = cv2.IMREAD_ANYDEPTH |
| 37 | img = cv2.imread(path, options) |
| 38 | if img is None: |
| 39 | raise IOError(f'Could not load image={path} with {options=}') |
| 40 | if img.ndim == 3: |
| 41 | img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) |
| 42 | return img |
| 43 | |
| 44 | |
| 45 | def rgb(ftensor, true_shape=None): |
no outgoing calls
no test coverage detected