para disp: disparity, [h, w] para rgb: rgb image, [h, w, 3], in rgb format
(depth, rgb, dir, pcd_name, focal)
| 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 | |
| 212 | def 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 | |
| 229 | def recover_metric_depth(pred, gt): |
nothing calls this directly
no test coverage detected