AnySplat / src /dataset /shims /load_shim.py
alexnasa's picture
Upload 243 files
2568013 verified
raw
history blame contribute delete
408 Bytes
import cv2
def imread_cv2(path, options=cv2.IMREAD_COLOR):
"""Open an image or a depthmap with opencv-python."""
if path.endswith((".exr", "EXR")):
options = cv2.IMREAD_ANYDEPTH
img = cv2.imread(path, options)
if img is None:
raise IOError(f"Could not load image={path} with {options=}")
if img.ndim == 3:
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
return img