1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/env python
import argparse
import os
from argaze.ArUcoMarkers import ArUcoMarkers
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=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()
# manage destination folder
if not os.path.exists(args.output):
os.makedirs(args.output)
print(f'{args.output} folder created')
# create aruco markers
aruco_markers = ArUcoMarkers.ArUcoMarkers(args.dictionary)
# export markers
aruco_markers.export_all(args.output, args.resolution)
if __name__ == '__main__':
main()
|