aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2023-03-29 09:07:29 +0200
committerThéo de la Hogue2023-03-29 09:07:29 +0200
commitec2610bcbea5644ba576ddd1ef28fabfe4810cc6 (patch)
tree64a8d68546cc0ddee018787b47a79076dc962890
parent3febfbdceb6f67e3cb8f8f4f4f2164f0be31333d (diff)
downloadargaze-ec2610bcbea5644ba576ddd1ef28fabfe4810cc6.zip
argaze-ec2610bcbea5644ba576ddd1ef28fabfe4810cc6.tar.gz
argaze-ec2610bcbea5644ba576ddd1ef28fabfe4810cc6.tar.bz2
argaze-ec2610bcbea5644ba576ddd1ef28fabfe4810cc6.tar.xz
Improving aruco markers dictionary exportation script.
-rw-r--r--src/argaze/utils/README.md4
-rw-r--r--src/argaze/utils/aruco_markers_dictionary_export.py32
-rw-r--r--src/argaze/utils/aruco_markers_export.py29
3 files changed, 34 insertions, 31 deletions
diff --git a/src/argaze/utils/README.md b/src/argaze/utils/README.md
index ea293f6..fa49ea5 100644
--- a/src/argaze/utils/README.md
+++ b/src/argaze/utils/README.md
@@ -6,12 +6,12 @@ Collection of ready-to-use commands based on ArGaze toolkit.
.. note::
*Use -h option to get command arguments documentation.*
-# ArUco factory
+# ArUco Markers factory
Export all markers from DICT_APRILTAG_16h5 dictionary as 5 cm pictures with 300 dpi resolution into an \_export/markers folder:
```
-python ./src/argaze/utils/aruco_markers_export.py -o _export/markers -d DICT_APRILTAG_16h5 -s 5 -r 300
+python ./src/argaze/utils/aruco_markers_dictionary_export.py DICT_APRILTAG_16h5 -s 5 -r 300 -o _export/markers
```
Export a 7 columns and 5 rows calibration board made of 5cm squares with 3cm markers from DICT_APRILTAG_16h5 dictionary at 300 dpi into an \_export folder:
diff --git a/src/argaze/utils/aruco_markers_dictionary_export.py b/src/argaze/utils/aruco_markers_dictionary_export.py
new file mode 100644
index 0000000..c8dd3ab
--- /dev/null
+++ b/src/argaze/utils/aruco_markers_dictionary_export.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+import argparse
+import os
+
+from argaze.ArUcoMarkers import ArUcoMarkersDictionary
+
+def main():
+ """Generates all ArUco markers from a given dictionary."""
+
+ # Manage arguments
+ parser = argparse.ArgumentParser(description=main.__doc__)
+ parser.add_argument('dictionary', metavar='DICT', type=ArUcoMarkersDictionary.ArUcoMarkersDictionary, default='DICT_ARUCO_ORIGINAL', help='aruco marker dictionnary (DICT_4X4_50, DICT_4X4_100, DICT_4X4_250, DICT_4X4_1000, DICT_5X5_50, DICT_5X5_100, DICT_5X5_250, DICT_5X5_1000, DICT_6X6_50, DICT_6X6_100, DICT_6X6_250, DICT_6X6_1000, DICT_7X7_50, DICT_7X7_100, DICT_7X7_250, DICT_7X7_1000, DICT_ARUCO_ORIGINAL, DICT_APRILTAG_16h5, DICT_APRILTAG_25h9, DICT_APRILTAG_36h10, DICT_APRILTAG_36h11)')
+ parser.add_argument('-s', '--size', metavar='SIZE', type=float, default=3., help='marker size in cm')
+ parser.add_argument('-r', '--resolution', metavar='RES', type=int, default=300, help='picture resolution in dpi')
+ parser.add_argument('-o', '--output', metavar='OUT', type=str, default='.', help='destination path')
+
+ args = parser.parse_args()
+
+ # Manage destination folder
+ if not os.path.exists(args.output):
+ os.makedirs(args.output)
+ print(f'{args.output} folder created.')
+
+ # Export markers
+ args.dictionary.save(args.output, args.size, args.resolution)
+
+ print(f'{args.dictionary.number} markers from {args.dictionary.name} dictionary exported into {args.output} folder.')
+
+if __name__ == '__main__':
+
+ main() \ No newline at end of file
diff --git a/src/argaze/utils/aruco_markers_export.py b/src/argaze/utils/aruco_markers_export.py
deleted file mode 100644
index 2115b2f..0000000
--- a/src/argaze/utils/aruco_markers_export.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-
-import argparse
-import os
-
-from argaze.ArUcoMarkers import ArUcoMarkersDictionary
-
-def main():
- """Generates ArUco markers to place into a scene."""
-
- # manage arguments
- parser = argparse.ArgumentParser(description=main.__doc__)
- parser.add_argument('-o', '--output', metavar='OUT', type=str, default='.', help='destination path')
- parser.add_argument('-d', '--dictionary', metavar='DICT', type=ArUcoMarkersDictionary.ArUcoMarkersDictionary, default='DICT_ARUCO_ORIGINAL', help='aruco marker dictionnary (DICT_4X4_50, DICT_4X4_100, DICT_4X4_250, DICT_4X4_1000, DICT_5X5_50, DICT_5X5_100, DICT_5X5_250, DICT_5X5_1000, DICT_6X6_50, DICT_6X6_100, DICT_6X6_250, DICT_6X6_1000, DICT_7X7_50, DICT_7X7_100, DICT_7X7_250, DICT_7X7_1000, DICT_ARUCO_ORIGINAL, DICT_APRILTAG_16h5, DICT_APRILTAG_25h9, DICT_APRILTAG_36h10, DICT_APRILTAG_36h11)')
- parser.add_argument('-s', '--size', metavar='SIZE', type=float, default=3., help='marker size in cm')
- parser.add_argument('-r', '--resolution', metavar='RES', type=int, default=300, help='picture resolution in dpi')
- args = parser.parse_args()
-
- # manage destination folder
- if not os.path.exists(args.output):
- os.makedirs(args.output)
- print(f'{args.output} folder created')
-
- # export markers
- args.dictionary.save(args.output, args.size, args.resolution)
-
-if __name__ == '__main__':
-
- main() \ No newline at end of file