aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--docs/user_guide/utils/demonstrations_scripts.md10
-rw-r--r--src/argaze/utils/demo_ar_features_run.py18
-rw-r--r--src/argaze/utils/demo_environment/demo.movbin0 -> 13345258 bytes
-rw-r--r--src/argaze/utils/demo_environment/demo_ar_features_setup.json2
-rw-r--r--src/argaze/utils/demo_environment/optic_parameters.json33
6 files changed, 46 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore
index f0d67e7..ba80f83 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,7 +5,6 @@ _projects
_workaround
dist
site
-optic_parameters.json
heatmap.png
edited_setup.json
*.egg-info
diff --git a/docs/user_guide/utils/demonstrations_scripts.md b/docs/user_guide/utils/demonstrations_scripts.md
index 4a54c5e..6666bb0 100644
--- a/docs/user_guide/utils/demonstrations_scripts.md
+++ b/docs/user_guide/utils/demonstrations_scripts.md
@@ -11,17 +11,17 @@ Collection of command-line scripts for demonstration purpose.
## AR environment demonstration
-Load AR environment from **setup.json** file, detect ArUco markers into camera device (-d DEVICE) images and estimate envirnoment pose.
+Load AR environment from **setup.json** file, detect ArUco markers into a demo video source and estimate environment pose.
```shell
-python ./src/argaze/utils/demo_ar_features_run.py ./src/argaze/utils/demo_environment/demo_ar_features_setup.json -d DEVICE
+python ./src/argaze/utils/demo_ar_features_run.py ./src/argaze/utils/demo_environment/demo_ar_features_setup.json -s ./src/argaze/utils/demo_environment/demo.mov
```
-!!! warning
- This demonstration assumes that camera calibration step is done and a **optic_parameters.json** has been exported into *./src/argaze/utils/demo_environment/* folder.
+!!! note
+ To reproduce this demonstration with live video source, camera calibration have to be done and exported into **./src/argaze/utils/demo_environment/optic_parameters.json** file.
!!! note
- Use **A3_demo.pdf** file located in *./src/argaze/utils/demo_environment/* folder ready to be printed on A3 paper sheet.
+ To reproduce this demonstration with live video source, print **A3_demo.pdf** file located in *./src/argaze/utils/demo_environment/* folder on A3 paper sheet.
## Gaze features demonstration
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
new file mode 100644
index 0000000..bba7999
--- /dev/null
+++ b/src/argaze/utils/demo_environment/demo.mov
Binary files differ
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