aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2022-11-28 17:33:54 +0100
committerThéo de la Hogue2022-11-28 17:33:54 +0100
commitce2aed19d689e38c4dde55da2e368f698e30f578 (patch)
treec3780c35f09e9303f6579288504cb8331be1429c
parent81170eac950fe1db167b11547c1ab7bf5f7dc233 (diff)
downloadargaze-ce2aed19d689e38c4dde55da2e368f698e30f578.zip
argaze-ce2aed19d689e38c4dde55da2e368f698e30f578.tar.gz
argaze-ce2aed19d689e38c4dde55da2e368f698e30f578.tar.bz2
argaze-ce2aed19d689e38c4dde55da2e368f698e30f578.tar.xz
Adding a new ArUcoSetFactory class.
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoSetFactory.py21
-rw-r--r--src/argaze/ArUcoMarkers/__init__.py2
2 files changed, 22 insertions, 1 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoSetFactory.py b/src/argaze/ArUcoMarkers/ArUcoSetFactory.py
new file mode 100644
index 0000000..230c9b3
--- /dev/null
+++ b/src/argaze/ArUcoMarkers/ArUcoSetFactory.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+import json
+
+from argaze.ArUcoMarkers import ArUcoPlan, ArUcoCube
+
+class ArUcoSetFactory():
+ """Define class to build specific ArUco markers set."""
+
+ @classmethod
+ def make(self, configuration_filepath):
+
+ with open(configuration_filepath) as configuration_file:
+
+ # Deserialize .json
+ configuration = json.load(configuration_file)
+
+ # Load set type
+ set_type = configuration['type']
+
+ return eval(f'{set_type}.{set_type}')(configuration_filepath) \ No newline at end of file
diff --git a/src/argaze/ArUcoMarkers/__init__.py b/src/argaze/ArUcoMarkers/__init__.py
index 73d0851..af43673 100644
--- a/src/argaze/ArUcoMarkers/__init__.py
+++ b/src/argaze/ArUcoMarkers/__init__.py
@@ -2,4 +2,4 @@
.. include:: README.md
"""
__docformat__ = "restructuredtext"
-__all__ = ['ArUcoMarkersDictionary', 'ArUcoMarker', 'ArUcoBoard', 'ArUcoCamera', 'ArUcoTracker', 'ArUcoSet', 'ArUcoPlan', 'ArUcoCube', ] \ No newline at end of file
+__all__ = ['ArUcoMarkersDictionary', 'ArUcoMarker', 'ArUcoBoard', 'ArUcoCamera', 'ArUcoTracker', 'ArUcoSet', 'ArUcoPlan', 'ArUcoCube', 'ArUcoSetFactory'] \ No newline at end of file