feat: enhance recording_multi.py and svo_playback.py with new CLI options and features
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# ... existing code ...
|
||||
import sys
|
||||
import pyzed.sl as sl
|
||||
import cv2
|
||||
import argparse
|
||||
import os
|
||||
import math
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def progress_bar(percent_done, bar_length=50):
|
||||
@@ -16,8 +16,38 @@ def progress_bar(percent_done, bar_length=50):
|
||||
|
||||
|
||||
def main(opt):
|
||||
svo_files = opt.input_svo_files
|
||||
input_paths = [Path(p) for p in opt.input_svo_files]
|
||||
svo_files = []
|
||||
|
||||
for path in input_paths:
|
||||
if path.is_dir():
|
||||
print(f"Searching for SVO files in {path}...")
|
||||
found = sorted(
|
||||
[
|
||||
str(f)
|
||||
for f in path.iterdir()
|
||||
if f.is_file() and f.suffix.lower() in (".svo", ".svo2")
|
||||
]
|
||||
)
|
||||
if found:
|
||||
print(f"Found {len(found)} files in {path}")
|
||||
svo_files.extend(found)
|
||||
else:
|
||||
print(f"No .svo or .svo2 files found in {path}")
|
||||
elif path.is_file():
|
||||
svo_files.append(str(path))
|
||||
else:
|
||||
print(f"Path not found: {path}")
|
||||
|
||||
if not svo_files:
|
||||
print("No valid SVO files provided. Exiting.")
|
||||
return
|
||||
|
||||
# Sort files to ensure deterministic order
|
||||
svo_files.sort()
|
||||
|
||||
cameras = []
|
||||
|
||||
cam_data = [] # List of dicts to store camera info
|
||||
|
||||
print(f"Opening {len(svo_files)} SVO files...")
|
||||
@@ -177,7 +207,7 @@ if __name__ == "__main__":
|
||||
"--input_svo_files",
|
||||
nargs="+",
|
||||
type=str,
|
||||
help="Path to .svo/.svo2 files",
|
||||
help="Path to .svo/.svo2 files or directories",
|
||||
required=True,
|
||||
)
|
||||
opt = parser.parse_args()
|
||||
|
||||
Reference in New Issue
Block a user