Skip to content

Commit aa35cb9

Browse files
authored
Fix a bug for point cloud saving (#95)
* merge depth files with metric depth * save point cloud for metric * update metric readme * remove duplicate files * Update README.md * Update README.md * optimize the point cloud saving * fix bugs for point cloud
1 parent 0873026 commit aa35cb9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

run.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
parser.add_argument('--grayscale', action='store_true', help='do not apply colorful palette')
3434
parser.add_argument('--save_npz', action='store_true', help='save depths as npz')
3535
parser.add_argument('--save_exr', action='store_true', help='save depths as exr')
36+
parser.add_argument('--focal-length-x', default=470.4, type=float,
37+
help='Focal length along the x-axis.')
38+
parser.add_argument('--focal-length-y', default=470.4, type=float,
39+
help='Focal length along the y-axis.')
3640

3741
args = parser.parse_args()
3842

@@ -53,8 +57,7 @@
5357
depths, fps = video_depth_anything.infer_video_depth(frames, target_fps, input_size=args.input_size, device=DEVICE, fp32=args.fp32)
5458

5559
video_name = os.path.basename(args.input_video)
56-
if not os.path.exists(args.output_dir):
57-
os.makedirs(args.output_dir)
60+
os.makedirs(args.output_dir, exist_ok=True)
5861

5962
processed_video_path = os.path.join(args.output_dir, os.path.splitext(video_name)[0]+'_src.mp4')
6063
depth_vis_path = os.path.join(args.output_dir, os.path.splitext(video_name)[0]+'_vis.mp4')
@@ -82,6 +85,7 @@
8285
if args.metric:
8386
import open3d as o3d
8487

88+
width, height = depths[0].shape[-1], depths[0].shape[-2]
8589
x, y = np.meshgrid(np.arange(width), np.arange(height))
8690
x = (x - width / 2) / args.focal_length_x
8791
y = (y - height / 2) / args.focal_length_y

0 commit comments

Comments
 (0)