Fix video 'pred_only' issue
This commit is contained in:
@@ -82,7 +82,7 @@ python run.py --encoder vitl --img-path assets/examples --outdir depth_vis
|
||||
**If you want to use Depth Anything V2 on videos:**
|
||||
|
||||
```bash
|
||||
python run_video.py --encoder vitl --video-path assets/examples_video --outdir video_depth_vis
|
||||
python run_video.py --encoder <vits | vitb | vitl> --video-path assets/examples_video --outdir video_depth_vis [--input-size <size>] [--pred-only] [--grayscale]
|
||||
```
|
||||
|
||||
*Please note that our larger model has better temporal consistency on videos.*
|
||||
|
@@ -56,7 +56,11 @@ if __name__ == '__main__':
|
||||
raw_video = cv2.VideoCapture(filename)
|
||||
frame_width, frame_height = int(raw_video.get(cv2.CAP_PROP_FRAME_WIDTH)), int(raw_video.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
||||
frame_rate = int(raw_video.get(cv2.CAP_PROP_FPS))
|
||||
output_width = frame_width * 2 + margin_width
|
||||
|
||||
if args.pred_only:
|
||||
output_width = frame_width
|
||||
else:
|
||||
output_width = frame_width * 2 + margin_width
|
||||
|
||||
output_path = os.path.join(args.outdir, os.path.splitext(os.path.basename(filename))[0] + '.mp4')
|
||||
out = cv2.VideoWriter(output_path, cv2.VideoWriter_fourcc(*"mp4v"), frame_rate, (output_width, frame_height))
|
||||
|
Reference in New Issue
Block a user