diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze.test/ArUcoMarkers/ArUcoCamera.py | 4 | ||||
-rw-r--r-- | src/argaze/__init__.py | 15 | ||||
-rw-r--r-- | src/argaze/__main__.py | 4 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/argaze.test/ArUcoMarkers/ArUcoCamera.py b/src/argaze.test/ArUcoMarkers/ArUcoCamera.py index 091383e..eb930ab 100644 --- a/src/argaze.test/ArUcoMarkers/ArUcoCamera.py +++ b/src/argaze.test/ArUcoMarkers/ArUcoCamera.py @@ -19,7 +19,7 @@ __license__ = "GPLv3" import unittest import os -from argaze.ArUcoMarkers import ArUcoCamera +import argaze import numpy @@ -34,7 +34,7 @@ class TestArUcoCameraClass(unittest.TestCase): json_filepath = os.path.join(current_directory, 'utils/aruco_camera.json') # Load test aruco camera - with ArUcoCamera.ArUcoCamera.from_json(json_filepath) as aruco_camera: + with argaze.load(json_filepath) as aruco_camera: # Check aruco camera meta data self.assertEqual(aruco_camera.name, "TestArUcoCamera") diff --git a/src/argaze/__init__.py b/src/argaze/__init__.py index 8c0068f..c492882 100644 --- a/src/argaze/__init__.py +++ b/src/argaze/__init__.py @@ -3,3 +3,18 @@ ArGaze is divided in submodules dedicated to various specifics features. """ __all__ = ['ArUcoMarkers', 'AreaOfInterest', 'ArFeatures', 'GazeFeatures', 'GazeAnalysis', 'PupilFeatures', 'PupilAnalysis', 'DataFeatures', 'utils'] + +def load(filepath: str) -> any: + """ + Load object instance from .json file. + + !!! note + The directory where configuration file is will be the global working directory. + + Parameters: + configuration_filepath: path to json configuration file + """ + + from argaze import DataFeatures + + return DataFeatures.from_json(filepath)
\ No newline at end of file diff --git a/src/argaze/__main__.py b/src/argaze/__main__.py index 3e1fe9e..bd0f34c 100644 --- a/src/argaze/__main__.py +++ b/src/argaze/__main__.py @@ -20,7 +20,7 @@ import argparse import logging import contextlib -from .DataFeatures import from_json +from . import load from .ArFeatures import ArCamera, ArContext import cv2 @@ -37,7 +37,7 @@ args = parser.parse_args() logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG if args.verbose else logging.INFO) # Load context from JSON file -with from_json(args.context_file) as context: +with load(args.context_file) as context: # Loaded object must be a subclass of ArContext if not issubclass(type(context), ArContext): |