tuned pipeline to 60 fps

This commit is contained in:
ykcheungab
2026-06-14 20:58:46 +08:00
parent 30bebcd439
commit fbee1c37ed
12 changed files with 339 additions and 37 deletions
+47 -9
View File
@@ -25,6 +25,9 @@ from orisys.unroll import (
load_calib_json,
load_exported_data,
recommend_edge_expand,
resolve_uv_runtime_sizes,
scale_camera_geometry,
scaled_map_cache_path,
)
@@ -60,13 +63,24 @@ def main():
parser.add_argument("--camera_id", type=int, default=0)
parser.add_argument("--video", help="Video file path (overrides camera)")
parser.add_argument("--config", "-c", default="./config/dd02-ov.json", help="Orisys SDK config")
parser.add_argument(
"--source_scale",
type=float,
default=None,
help="Resize live source before UV remap (default: camera.source_scale in config)",
)
parser.add_argument("--no_flip_source_vertical", action="store_true", help="Skip vertical flip before UV remap")
parser.add_argument("--show", action="store_true", help="Show unrolled image window")
parser.add_argument("--verbose", action="store_true", help="SDK verbose logs")
args = parser.parse_args()
sdk_config = load_config(args.config)
out_width, out_height = sdk_config["camera"]["resolution_stitch"]
camera_config = sdk_config.get("camera", {})
out_width, out_height, source_scale = resolve_uv_runtime_sizes(
camera_config,
source_scale=args.source_scale,
)
map_cache = scaled_map_cache_path(args.map_cache, source_scale)
mesh_path, intrinsics_path, pose_path = resolve_export_paths(args.export_dir)
@@ -76,18 +90,31 @@ def main():
if args.calib:
source_K, dist_coeffs, img_size = load_calib_json(args.calib)
source_width, source_height = img_size
native_width, native_height = img_size
else:
source_K = data["K"]
dist_coeffs = None
source_width = data["width"]
source_height = data["height"]
native_width = data["width"]
native_height = data["height"]
source_K, source_width, source_height = scale_camera_geometry(
source_K,
native_width,
native_height,
source_scale,
)
if args.verbose:
print(
f"UV geometry: native={native_width}x{native_height}, "
f"source={source_width}x{source_height} (scale={source_scale:g}), "
f"output={out_width}x{out_height}, map_cache={map_cache}"
)
domain = build_or_load_domain(
mesh_path,
intrinsics_path,
pose_path,
args.map_cache,
map_cache,
source_K,
source_width,
source_height,
@@ -96,6 +123,7 @@ def main():
edge_expand=edge_expand,
include_surface=True,
verbose=args.verbose,
source_scale=source_scale,
)
domain.remap.ensure_fast_maps()
@@ -103,8 +131,8 @@ def main():
if not cap.isOpened():
print("Cannot open camera/video source", file=sys.stderr)
sys.exit(1)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, source_width)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, source_height)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, native_width)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, native_height)
sensor = orisys.Sensor("external", config_name=args.config, verbose=args.verbose, mirror=False)
processor = UVUnrollFrameProcessor(
@@ -162,8 +190,9 @@ def main():
sensor.compute_deformation(check_motion=True, threshold=0)
sensor.compute_contact()
fps, fnormal, fshearx, fsheary = sensor.read_info(
fps, flow,fnormal, fshearx, fsheary = sensor.read_info(
sensor.info.FPS,
sensor.info.VRAW,
sensor.info.FNORMAL,
sensor.info.FSHEARX,
sensor.info.FSHEARY,
@@ -175,8 +204,17 @@ def main():
end="\r",
)
if args.show:
cv2.imshow("UV Unrolled", unrolled)
arrows = orisys.util.draw_arrows(
unrolled,
flow,
threshold=0.4,
grid_spacing=10,
arrow_scale=1.0,
)
cv2.imshow("UV Unrolled", arrows)
key = cv2.waitKey(1) & 0xFF
if key == ord("q"):