53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Shim for the Orisys 2D Qt sensor monitor (see examples/gui/viewer2d/)."""
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
os.environ.setdefault("OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS", "0")
|
|
|
|
_EXAMPLES_DIR = Path(__file__).resolve().parents[1] / "examples"
|
|
if str(_EXAMPLES_DIR) not in sys.path:
|
|
sys.path.insert(0, str(_EXAMPLES_DIR))
|
|
|
|
from gui.viewer2d import run_viewer
|
|
|
|
|
|
def main():
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser(description="Orisys 2D Qt sensor monitor")
|
|
parser.add_argument(
|
|
"--sensor-type",
|
|
"-s",
|
|
type=str,
|
|
default="orisys",
|
|
choices=("orisys", "dd06"),
|
|
help="Sensor adapter: orisys (direct Sensor) or dd06 (polygon ROI rectify)",
|
|
)
|
|
parser.add_argument("--video", "-v", type=str, default="0")
|
|
parser.add_argument("--config", "-c", type=str, default="./config/ddjx01.json")
|
|
parser.add_argument("--cal", "-cal", type=str, default="./config/ddjx01.npy")
|
|
parser.add_argument("--verbose", "-verbose", type=bool, default=True)
|
|
parser.add_argument(
|
|
"--cutoff",
|
|
type=float,
|
|
default=10.0,
|
|
help="Low-pass cutoff for force curves (Hz), sample rate 30 Hz",
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
# Sensible DD06 defaults when user only switches sensor type.
|
|
if args.sensor_type == "dd06":
|
|
if args.video in ("0", "1") and args.config.endswith("ddjx01.json"):
|
|
args.video = "./data/dd06/0726.mp4"
|
|
args.config = "./config/dd06-ov.json"
|
|
|
|
log_dir = Path(__file__).resolve().parent / "logs"
|
|
sys.exit(run_viewer(args, log_dir=log_dir))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|