diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/utils/demo_ar_features_run.py | 18 | ||||
-rw-r--r-- | src/argaze/utils/demo_environment/demo.mov | bin | 0 -> 13345258 bytes | |||
-rw-r--r-- | src/argaze/utils/demo_environment/demo_ar_features_setup.json | 2 | ||||
-rw-r--r-- | src/argaze/utils/demo_environment/optic_parameters.json | 33 |
4 files changed, 41 insertions, 12 deletions
diff --git a/src/argaze/utils/demo_ar_features_run.py b/src/argaze/utils/demo_ar_features_run.py index 5e63a2d..2abedd5 100644 --- a/src/argaze/utils/demo_ar_features_run.py +++ b/src/argaze/utils/demo_ar_features_run.py @@ -8,6 +8,7 @@ __copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)" __license__ = "BSD" import argparse +import contextlib import os import time @@ -26,7 +27,7 @@ def main(): # Manage arguments parser = argparse.ArgumentParser(description=main.__doc__.split('-')[0]) parser.add_argument('environment', metavar='ENVIRONMENT', type=str, help='ar environment filepath') - parser.add_argument('-d', '--device', metavar='DEVICE', type=int, default=0, help='video capture device id') + parser.add_argument('-s', '--source', metavar='SOURCE', type=str, default=0, help='video capture source (int for device id or str for movie filepath)') args = parser.parse_args() # Load AR enviroment @@ -56,11 +57,11 @@ def main(): # Attach mouse callback to window cv2.setMouseCallback(ar_environment.name, on_mouse_event) - # Enable camera video capture - video_capture = cv2.VideoCapture(args.device) + # Enable camera video capture into separate thread + video_capture = cv2.VideoCapture(int(args.source) if args.source.isdecimal() else args.source) # Waiting for 'ctrl+C' interruption - try: + with contextlib.suppress(KeyboardInterrupt): # Capture images while video_capture.isOpened(): @@ -107,14 +108,9 @@ def main(): # Stop by pressing 'Esc' key if cv2.waitKey(10) == 27: - break - # Stop on 'ctrl+C' interruption - except KeyboardInterrupt: - pass - - # Close camera video capture - video_capture.release() + # Close camera video capture + video_capture.release() # Stop image display cv2.destroyAllWindows() diff --git a/src/argaze/utils/demo_environment/demo.mov b/src/argaze/utils/demo_environment/demo.mov Binary files differnew file mode 100644 index 0000000..bba7999 --- /dev/null +++ b/src/argaze/utils/demo_environment/demo.mov diff --git a/src/argaze/utils/demo_environment/demo_ar_features_setup.json b/src/argaze/utils/demo_environment/demo_ar_features_setup.json index 3e030f8..6f79318 100644 --- a/src/argaze/utils/demo_environment/demo_ar_features_setup.json +++ b/src/argaze/utils/demo_environment/demo_ar_features_setup.json @@ -7,7 +7,7 @@ "marker_size": 5, "optic_parameters": "optic_parameters.json", "parameters": { - "cornerRefinementMethod": 1, + "cornerRefinementMethod": 3, "aprilTagQuadSigma": 2, "aprilTagDeglitch": 1 } diff --git a/src/argaze/utils/demo_environment/optic_parameters.json b/src/argaze/utils/demo_environment/optic_parameters.json new file mode 100644 index 0000000..aec1bd8 --- /dev/null +++ b/src/argaze/utils/demo_environment/optic_parameters.json @@ -0,0 +1,33 @@ +{ + "rms": 0.2295593838453216, + "dimensions": [ + 1280, + 720 + ], + "K": [ + [ + 970.7739542622236, + 0.0, + 644.9644070624494 + ], + [ + 0.0, + 970.3927308620368, + 354.9165119494194 + ], + [ + 0.0, + 0.0, + 1.0 + ] + ], + "D": [ + [ + -0.07708562133121194, + 0.6594792466909837, + 0.0011187458353557592, + 0.0008902964964825645, + -1.4155230084752772 + ] + ] +}
\ No newline at end of file |