aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2022-03-29 14:01:37 +0200
committerThéo de la Hogue2022-03-29 14:01:37 +0200
commit2eaaecf84323676095f4b33cdcbb139257ed7a85 (patch)
tree1c05fe993e1a93520e7313a6bf99e9c8fcff5176 /src
parenteeb0d3e69dfde4849611b2ae6dac0d03da7d220b (diff)
downloadargaze-2eaaecf84323676095f4b33cdcbb139257ed7a85.zip
argaze-2eaaecf84323676095f4b33cdcbb139257ed7a85.tar.gz
argaze-2eaaecf84323676095f4b33cdcbb139257ed7a85.tar.bz2
argaze-2eaaecf84323676095f4b33cdcbb139257ed7a85.tar.xz
Handling ORIGINAL and APRILTAG ArUco library markers
Diffstat (limited to 'src')
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoMarkers.py47
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoTracker.py10
-rw-r--r--src/argaze/ArUcoMarkers/README.md5
-rw-r--r--src/argaze/utils/export_aruco_markers.py2
4 files changed, 60 insertions, 4 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoMarkers.py b/src/argaze/ArUcoMarkers/ArUcoMarkers.py
index 9a5c519..f1d455f 100644
--- a/src/argaze/ArUcoMarkers/ArUcoMarkers.py
+++ b/src/argaze/ArUcoMarkers/ArUcoMarkers.py
@@ -22,7 +22,11 @@ ARUCO_DICT = {
'DICT_7X7_100': aruco.DICT_7X7_100,
'DICT_7X7_250': aruco.DICT_7X7_250,
'DICT_7X7_1000': aruco.DICT_7X7_1000,
- 'DICT_ARUCO_ORIGINAL': aruco.DICT_ARUCO_ORIGINAL
+ 'DICT_ARUCO_ORIGINAL': aruco.DICT_ARUCO_ORIGINAL,
+ 'DICT_APRILTAG_16h5': aruco.DICT_APRILTAG_16h5,
+ 'DICT_APRILTAG_25h9': aruco.DICT_APRILTAG_16h5,
+ 'DICT_APRILTAG_36h10': aruco.DICT_APRILTAG_36h10,
+ 'DICT_APRILTAG_36h11': aruco.DICT_APRILTAG_36h11
}
class ArUcoMarkers():
@@ -47,6 +51,10 @@ class ArUcoMarkers():
- DICT_7X7_250
- DICT_7X7_1000
- DICT_ARUCO_ORIGINAL
+ - DICT_APRILTAG_16h5
+ - DICT_APRILTAG_25h9
+ - DICT_APRILTAG_36h10
+ - DICT_APRILTAG_36h11
"""
# check aruco dictionary name
@@ -56,7 +64,42 @@ class ArUcoMarkers():
dict_name_split = aruco_dictionary_name.split('_')
self.__aruco_dict_format = dict_name_split[1]
- self.__aruco_dict_number = int(dict_name_split[2])
+
+ # DICT_ARUCO_ORIGINAL case
+ if self.__aruco_dict_format == 'ARUCO':
+
+ self.__aruco_dict_format = '5X5'
+ self.__aruco_dict_number = 1024
+
+ # DICT_APRILTAG_ case
+ elif self.__aruco_dict_format == 'APRILTAG':
+
+ april_tag_format = dict_name_split[2]
+
+ if april_tag_format == '16h5':
+
+ self.__aruco_dict_format = '4X4'
+ self.__aruco_dict_number = 30
+
+ elif april_tag_format == '25h9':
+
+ self.__aruco_dict_format = '5X5'
+ self.__aruco_dict_number = 35
+
+ elif april_tag_format == '36h10':
+
+ self.__aruco_dict_format = '6X6'
+ self.__aruco_dict_number = 2320
+
+ elif april_tag_format == '36h11':
+
+ self.__aruco_dict_format = '6X6'
+ self.__aruco_dict_number = 587
+
+ # other cases
+ else:
+
+ self.__aruco_dict_number = int(dict_name_split[2])
# load ArUco dictionary
self.__aruco_dict = aruco.Dictionary_get(ARUCO_DICT[aruco_dictionary_name])
diff --git a/src/argaze/ArUcoMarkers/ArUcoTracker.py b/src/argaze/ArUcoMarkers/ArUcoTracker.py
index f5adb4c..93cb5c8 100644
--- a/src/argaze/ArUcoMarkers/ArUcoTracker.py
+++ b/src/argaze/ArUcoMarkers/ArUcoTracker.py
@@ -22,7 +22,11 @@ ARUCO_DICT = {
'DICT_7X7_100': aruco.DICT_7X7_100,
'DICT_7X7_250': aruco.DICT_7X7_250,
'DICT_7X7_1000': aruco.DICT_7X7_1000,
- 'DICT_ARUCO_ORIGINAL': aruco.DICT_ARUCO_ORIGINAL
+ 'DICT_ARUCO_ORIGINAL': aruco.DICT_ARUCO_ORIGINAL,
+ 'DICT_APRILTAG_16h5': aruco.DICT_APRILTAG_16h5,
+ 'DICT_APRILTAG_25h9': aruco.DICT_APRILTAG_16h5,
+ 'DICT_APRILTAG_36h10': aruco.DICT_APRILTAG_36h10,
+ 'DICT_APRILTAG_36h11': aruco.DICT_APRILTAG_36h11
}
class ArUcoTracker():
@@ -47,6 +51,10 @@ class ArUcoTracker():
- DICT_7X7_250
- DICT_7X7_1000
- DICT_ARUCO_ORIGINAL
+ - DICT_APRILTAG_16h5
+ - DICT_APRILTAG_25h9
+ - DICT_APRILTAG_36h10
+ - DICT_APRILTAG_36h11
"""
# check aruco dictionary name
diff --git a/src/argaze/ArUcoMarkers/README.md b/src/argaze/ArUcoMarkers/README.md
index f882cce..82f63c4 100644
--- a/src/argaze/ArUcoMarkers/README.md
+++ b/src/argaze/ArUcoMarkers/README.md
@@ -1,5 +1,10 @@
Class interface to work with [OpenCV ArUco markers](https://docs.opencv.org/4.x/d5/dae/tutorial_aruco_detection.html).
+## ArUco library markers
+
+To work with ArUco markers, you need to choose a marker library which have diffirents property concerning the difference between each markers to avoid error in tracking.
+Here is more [about ArUco library markers](https://docs.opencv.org/3.4/d9/d6a/group__aruco.html#gac84398a9ed9dd01306592dd616c2c975)
+
## Utils
Print **A3_board_35cmx25cm_markers_4X4_3cm.pdf** onto A3 paper sheet to get board at expected dimensions.
diff --git a/src/argaze/utils/export_aruco_markers.py b/src/argaze/utils/export_aruco_markers.py
index 2f6fe73..2bc878e 100644
--- a/src/argaze/utils/export_aruco_markers.py
+++ b/src/argaze/utils/export_aruco_markers.py
@@ -11,7 +11,7 @@ def main():
# 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=str, default='DICT_4X4_50', 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)')
+ parser.add_argument('-d', '--dictionary', metavar='DICT', type=str, 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('-r', '--resolution', metavar='RES', type=int, default=300, help='picture resolution in dpi')
args = parser.parse_args()