MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / reconstruct_depth

Function reconstruct_depth

lib/test_utils.py:212–226  ·  view source on GitHub ↗

para disp: disparity, [h, w] para rgb: rgb image, [h, w, 3], in rgb format

(depth, rgb, dir, pcd_name, focal)

Source from the content-addressed store, hash-verified

210 np.savetxt(filename, np.column_stack((x, y, z, r, g, b)), fmt="%d %d %d %d %d %d", header=ply_head, comments='')
211
212def reconstruct_depth(depth, rgb, dir, pcd_name, focal):
213 """
214 para disp: disparity, [h, w]
215 para rgb: rgb image, [h, w, 3], in rgb format
216 """
217 rgb = np.squeeze(rgb)
218 depth = np.squeeze(depth)
219
220 mask = depth < 1e-8
221 depth[mask] = 0
222 depth = depth / depth.max() * 10000
223
224 pcd = reconstruct_3D(depth, f=focal)
225 rgb_n = np.reshape(rgb, (-1, 3))
226 save_point_cloud(pcd, rgb_n, os.path.join(dir, pcd_name + '.ply'))
227
228
229def recover_metric_depth(pred, gt):

Callers

nothing calls this directly

Calls 2

reconstruct_3DFunction · 0.85
save_point_cloudFunction · 0.85

Tested by

no test coverage detected