|
33 | 33 | parser.add_argument('--grayscale', action='store_true', help='do not apply colorful palette')
|
34 | 34 | parser.add_argument('--save_npz', action='store_true', help='save depths as npz')
|
35 | 35 | 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.') |
36 | 40 |
|
37 | 41 | args = parser.parse_args()
|
38 | 42 |
|
|
53 | 57 | depths, fps = video_depth_anything.infer_video_depth(frames, target_fps, input_size=args.input_size, device=DEVICE, fp32=args.fp32)
|
54 | 58 |
|
55 | 59 | 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) |
58 | 61 |
|
59 | 62 | processed_video_path = os.path.join(args.output_dir, os.path.splitext(video_name)[0]+'_src.mp4')
|
60 | 63 | depth_vis_path = os.path.join(args.output_dir, os.path.splitext(video_name)[0]+'_vis.mp4')
|
|
82 | 85 | if args.metric:
|
83 | 86 | import open3d as o3d
|
84 | 87 |
|
| 88 | + width, height = depths[0].shape[-1], depths[0].shape[-2] |
85 | 89 | x, y = np.meshgrid(np.arange(width), np.arange(height))
|
86 | 90 | x = (x - width / 2) / args.focal_length_x
|
87 | 91 | y = (y - height / 2) / args.focal_length_y
|
|
0 commit comments