Load and resize a depth map.
(path, H, W)
| 40 | return img |
| 41 | |
| 42 | def get_depth(path, H, W): |
| 43 | """Load and resize a depth map.""" |
| 44 | if path.endswith('.exr'): |
| 45 | depth = cv2.imread(path, cv2.IMREAD_ANYDEPTH | cv2.IMREAD_UNCHANGED) |
| 46 | else: |
| 47 | depth = cv2.imread(path, cv2.IMREAD_ANYDEPTH) |
| 48 | if depth is None: |
| 49 | depth = np.zeros((H, W), dtype=np.float32) |
| 50 | else: |
| 51 | depth = cv2.resize(depth.astype(np.float32), (W, H), interpolation=cv2.INTER_LINEAR) |
| 52 | return depth |
| 53 | |
| 54 | def load_model_weights(model, decoder_path, device, compile=False): |
| 55 | """Loads weights from the trained decoder checkpoint.""" |