diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/ArUcoMarkers/ArUcoSetFactory.py | 21 | ||||
-rw-r--r-- | src/argaze/ArUcoMarkers/__init__.py | 2 |
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 |