MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / resize_depth

Function resize_depth

ldm/modules/midas/utils.py:151–168  ·  view source on GitHub ↗

Resize depth map and bring to CPU (numpy). Args: depth (tensor): depth width (int): image width height (int): image height Returns: array: processed depth

(depth, width, height)

Source from the content-addressed store, hash-verified

149
150
151def resize_depth(depth, width, height):
152 """Resize depth map and bring to CPU (numpy).
153
154 Args:
155 depth (tensor): depth
156 width (int): image width
157 height (int): image height
158
159 Returns:
160 array: processed depth
161 """
162 depth = torch.squeeze(depth[0, :, :, :]).to("cpu")
163
164 depth_resized = cv2.resize(
165 depth.numpy(), (width, height), interpolation=cv2.INTER_CUBIC
166 )
167
168 return depth_resized
169
170def write_depth(path, depth, bits=1):
171 """Write depth map to pfm and png file.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected