aboutsummaryrefslogtreecommitdiff
path: root/src/argaze
diff options
context:
space:
mode:
authorThéo de la Hogue2024-04-17 13:32:51 +0200
committerThéo de la Hogue2024-04-17 13:32:51 +0200
commit4d0de7c804914a55977635ec6bc46beb0cf7808a (patch)
treeb3e40c76052b067723bfc41547b81a38a0da00b2 /src/argaze
parent9e0e2db258a2a475637813649e81b7e400b17022 (diff)
downloadargaze-4d0de7c804914a55977635ec6bc46beb0cf7808a.zip
argaze-4d0de7c804914a55977635ec6bc46beb0cf7808a.tar.gz
argaze-4d0de7c804914a55977635ec6bc46beb0cf7808a.tar.bz2
argaze-4d0de7c804914a55977635ec6bc46beb0cf7808a.tar.xz
Renaming ArUcoMarkers into ArUcoMarker
Diffstat (limited to 'src/argaze')
-rw-r--r--src/argaze/ArUcoMarker/ArUcoBoard.py (renamed from src/argaze/ArUcoMarkers/ArUcoBoard.py)4
-rw-r--r--src/argaze/ArUcoMarker/ArUcoCamera.py (renamed from src/argaze/ArUcoMarkers/ArUcoCamera.py)2
-rw-r--r--src/argaze/ArUcoMarker/ArUcoDetector.py (renamed from src/argaze/ArUcoMarkers/ArUcoDetector.py)6
-rw-r--r--src/argaze/ArUcoMarker/ArUcoMarker.py (renamed from src/argaze/ArUcoMarkers/ArUcoMarker.py)4
-rw-r--r--src/argaze/ArUcoMarker/ArUcoMarkerDictionary.py (renamed from src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py)4
-rw-r--r--src/argaze/ArUcoMarker/ArUcoMarkerGroup.py (renamed from src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py)14
-rw-r--r--src/argaze/ArUcoMarker/ArUcoOpticCalibrator.py (renamed from src/argaze/ArUcoMarkers/ArUcoOpticCalibrator.py)4
-rw-r--r--src/argaze/ArUcoMarker/ArUcoScene.py (renamed from src/argaze/ArUcoMarkers/ArUcoScene.py)10
-rw-r--r--src/argaze/ArUcoMarker/__init__.py6
-rw-r--r--src/argaze/ArUcoMarker/utils/A3_DICT_APRILTAG_16h5_3cm_35cmx25cm.pdf (renamed from src/argaze/ArUcoMarkers/utils/A3_DICT_APRILTAG_16h5_3cm_35cmx25cm.pdf)bin97542 -> 97542 bytes
-rw-r--r--src/argaze/ArUcoMarker/utils/A4_DICT_APRILTAG_16h5_5cm_0-7.pdf (renamed from src/argaze/ArUcoMarkers/utils/A4_DICT_APRILTAG_16h5_5cm_0-7.pdf)bin37670 -> 37670 bytes
-rw-r--r--src/argaze/ArUcoMarker/utils/__init__.py (renamed from src/argaze/ArUcoMarkers/utils/__init__.py)0
-rw-r--r--src/argaze/ArUcoMarkers/__init__.py6
-rw-r--r--src/argaze/__init__.py2
-rw-r--r--src/argaze/utils/aruco_markers_group_export.py234
-rw-r--r--src/argaze/utils/demo/aruco_markers_pipeline.json2
16 files changed, 32 insertions, 266 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoBoard.py b/src/argaze/ArUcoMarker/ArUcoBoard.py
index be475d5..ce8097f 100644
--- a/src/argaze/ArUcoMarkers/ArUcoBoard.py
+++ b/src/argaze/ArUcoMarker/ArUcoBoard.py
@@ -22,7 +22,7 @@ from typing import Sequence
import cv2 as cv
import cv2.aruco as aruco
-from argaze.ArUcoMarkers import ArUcoMarkersDictionary
+from argaze.ArUcoMarker import ArUcoMarkerDictionary
@dataclass
@@ -41,7 +41,7 @@ class ArUcoBoard():
marker_size: float = field(default=0.)
"""Size of ArUco markers inside board squares in centimeter."""
- dictionary: ArUcoMarkersDictionary.ArUcoMarkersDictionary = field(default_factory=ArUcoMarkersDictionary.ArUcoMarkersDictionary)
+ dictionary: ArUcoMarkerDictionary.ArUcoMarkerDictionary = field(default_factory=ArUcoMarkerDictionary.ArUcoMarkerDictionary)
"""ArUco markers dictionary."""
def __post_init__(self):
diff --git a/src/argaze/ArUcoMarkers/ArUcoCamera.py b/src/argaze/ArUcoMarker/ArUcoCamera.py
index 5b535b5..2402df0 100644
--- a/src/argaze/ArUcoMarkers/ArUcoCamera.py
+++ b/src/argaze/ArUcoMarker/ArUcoCamera.py
@@ -22,7 +22,7 @@ import cv2
import numpy
from argaze import ArFeatures, DataFeatures
-from argaze.ArUcoMarkers import ArUcoDetector, ArUcoOpticCalibrator, ArUcoScene
+from argaze.ArUcoMarker import ArUcoDetector, ArUcoOpticCalibrator, ArUcoScene
from argaze.AreaOfInterest import AOI2DScene
# Define default ArUcoCamera image_parameters values
diff --git a/src/argaze/ArUcoMarkers/ArUcoDetector.py b/src/argaze/ArUcoMarker/ArUcoDetector.py
index f675c8f..daa0f9d 100644
--- a/src/argaze/ArUcoMarkers/ArUcoDetector.py
+++ b/src/argaze/ArUcoMarker/ArUcoDetector.py
@@ -25,7 +25,7 @@ import numpy
from cv2 import aruco
from argaze import DataFeatures
-from argaze.ArUcoMarkers import ArUcoMarkersDictionary, ArUcoMarker, ArUcoOpticCalibrator
+from argaze.ArUcoMarker import ArUcoMarkerDictionary, ArUcoMarker, ArUcoOpticCalibrator
class DetectorParameters():
@@ -145,13 +145,13 @@ class ArUcoDetector(DataFeatures.PipelineStepObject):
self.__board_corners_ids = []
@property
- def dictionary(self) -> ArUcoMarkersDictionary.ArUcoMarkersDictionary:
+ def dictionary(self) -> ArUcoMarkerDictionary.ArUcoMarkerDictionary:
"""ArUco markers dictionary to detect."""
return self.__dictionary
@dictionary.setter
@DataFeatures.PipelineStepAttributeSetter
- def dictionary(self, dictionary: ArUcoMarkersDictionary.ArUcoMarkersDictionary):
+ def dictionary(self, dictionary: ArUcoMarkerDictionary.ArUcoMarkerDictionary):
self.__dictionary = dictionary
diff --git a/src/argaze/ArUcoMarkers/ArUcoMarker.py b/src/argaze/ArUcoMarker/ArUcoMarker.py
index cf573dc..fdc8071 100644
--- a/src/argaze/ArUcoMarkers/ArUcoMarker.py
+++ b/src/argaze/ArUcoMarker/ArUcoMarker.py
@@ -19,7 +19,7 @@ __license__ = "GPLv3"
from dataclasses import dataclass, field
import math
-from argaze.ArUcoMarkers import ArUcoMarkersDictionary
+from argaze.ArUcoMarker import ArUcoMarkerDictionary
import numpy
import cv2
@@ -29,7 +29,7 @@ import cv2.aruco as aruco
class ArUcoMarker():
"""Define ArUco marker class."""
- dictionary: ArUcoMarkersDictionary.ArUcoMarkersDictionary
+ dictionary: ArUcoMarkerDictionary.ArUcoMarkerDictionary
"""Dictionary to which it belongs."""
identifier: int
diff --git a/src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py b/src/argaze/ArUcoMarker/ArUcoMarkerDictionary.py
index 613a3c5..ed423f1 100644
--- a/src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py
+++ b/src/argaze/ArUcoMarker/ArUcoMarkerDictionary.py
@@ -43,7 +43,7 @@ all_aruco_markers_dictionaries = {
}
"""Dictionary to list all built-in ArUco markers dictionaries from OpenCV ArUco package."""
-class ArUcoMarkersDictionary():
+class ArUcoMarkerDictionary():
"""Handle an ArUco markers dictionary."""
def __init__(self, name: str = 'DICT_ARUCO_ORIGINAL'):
@@ -145,7 +145,7 @@ class ArUcoMarkersDictionary():
if i >= 0 and i < self.number:
- from argaze.ArUcoMarkers import ArUcoMarker
+ from argaze.ArUcoMarker import ArUcoMarker
return ArUcoMarker.ArUcoMarker(self, i, size)
diff --git a/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py b/src/argaze/ArUcoMarker/ArUcoMarkerGroup.py
index fd33664..b013829 100644
--- a/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py
+++ b/src/argaze/ArUcoMarker/ArUcoMarkerGroup.py
@@ -25,7 +25,7 @@ import cv2
import numpy
from argaze import DataFeatures
-from argaze.ArUcoMarkers import ArUcoMarkersDictionary, ArUcoMarker
+from argaze.ArUcoMarker import ArUcoMarkerDictionary, ArUcoMarker
T0 = numpy.array([0., 0., 0.])
"""Define no translation vector."""
@@ -76,7 +76,7 @@ class Place:
marker: ArUcoMarker.ArUcoMarker
-class ArUcoMarkersGroup(DataFeatures.PipelineStepObject):
+class ArUcoMarkerGroup(DataFeatures.PipelineStepObject):
"""
Handle group of ArUco markers as one unique spatial entity and estimate its pose.
"""
@@ -84,7 +84,7 @@ class ArUcoMarkersGroup(DataFeatures.PipelineStepObject):
# noinspection PyMissingConstructor
@DataFeatures.PipelineStepInit
def __init__(self, **kwargs):
- """Initialize ArUcoMarkersGroup"""
+ """Initialize ArUcoMarkerGroup"""
# Init private attributes
self.marker_size = None
@@ -94,12 +94,12 @@ class ArUcoMarkersGroup(DataFeatures.PipelineStepObject):
self.__rotation = numpy.zeros(3)
@property
- def dictionary(self) -> ArUcoMarkersDictionary.ArUcoMarkersDictionary:
+ def dictionary(self) -> ArUcoMarkerDictionary.ArUcoMarkerDictionary:
"""Expected dictionary of all markers in the group."""
return self.__dictionary
@dictionary.setter
- def dictionary(self, dictionary: ArUcoMarkersDictionary.ArUcoMarkersDictionary):
+ def dictionary(self, dictionary: ArUcoMarkerDictionary.ArUcoMarkerDictionary):
self.__dictionary = dictionary
@@ -265,7 +265,7 @@ class ArUcoMarkersGroup(DataFeatures.PipelineStepObject):
# Init new group dictionary with first dictionary name
if new_dictionary is None:
- new_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary(dictionary)
+ new_dictionary = ArUcoMarkerDictionary.ArUcoMarkerDictionary(dictionary)
# Check all others marker dictionary are equal to new group dictionary
elif dictionary != new_dictionary.name:
@@ -322,7 +322,7 @@ class ArUcoMarkersGroup(DataFeatures.PipelineStepObject):
'places': new_places
}
- return ArUcoMarkersGroup(**data)
+ return ArUcoMarkerGroup(**data)
def filter_markers(self, detected_markers: dict) -> tuple[dict, dict]:
"""Sort markers belonging to the group from given detected markers dict (cf ArUcoDetector.detect_markers()).
diff --git a/src/argaze/ArUcoMarkers/ArUcoOpticCalibrator.py b/src/argaze/ArUcoMarker/ArUcoOpticCalibrator.py
index 7d4b271..468e64a 100644
--- a/src/argaze/ArUcoMarkers/ArUcoOpticCalibrator.py
+++ b/src/argaze/ArUcoMarker/ArUcoOpticCalibrator.py
@@ -19,7 +19,7 @@ __license__ = "GPLv3"
from dataclasses import dataclass, field
from argaze import DataFeatures
-from argaze.ArUcoMarkers import ArUcoBoard
+from argaze.ArUcoMarker import ArUcoBoard
import json
import numpy
@@ -125,7 +125,7 @@ class ArUcoOpticCalibrator():
"""Retrieve K and D parameters from stored calibration data.
Parameters:
- board: [ArUcoBoard](argaze.md/#argaze.ArUcoMarkers.ArUcoBoard.ArUcoBoard) instance
+ board: [ArUcoBoard](argaze.md/#argaze.ArUcoMarker.ArUcoBoard.ArUcoBoard) instance
dimensions: camera image dimensions
Returns:
diff --git a/src/argaze/ArUcoMarkers/ArUcoScene.py b/src/argaze/ArUcoMarker/ArUcoScene.py
index 0edb253..a4726fa 100644
--- a/src/argaze/ArUcoMarkers/ArUcoScene.py
+++ b/src/argaze/ArUcoMarker/ArUcoScene.py
@@ -19,12 +19,12 @@ __license__ = "GPLv3"
import numpy
from argaze import ArFeatures, DataFeatures
-from argaze.ArUcoMarkers import ArUcoMarkersGroup
+from argaze.ArUcoMarker import ArUcoMarkerGroup
class ArUcoScene(ArFeatures.ArScene):
"""
- Define an ArScene based on an ArUcoMarkersGroup description.
+ Define an ArScene based on an ArUcoMarkerGroup description.
"""
@DataFeatures.PipelineStepInit
@@ -39,13 +39,13 @@ class ArUcoScene(ArFeatures.ArScene):
self.__required_markers_number = 2
@property
- def aruco_markers_group(self) -> ArUcoMarkersGroup.ArUcoMarkersGroup:
+ def aruco_markers_group(self) -> ArUcoMarkerGroup.ArUcoMarkerGroup:
"""ArUco markers 3D scene description used to estimate scene pose from detected markers: see [estimate_pose][argaze.ArFeatures.ArScene.estimate_pose] function below."""
return self.__aruco_markers_group
@aruco_markers_group.setter
@DataFeatures.PipelineStepAttributeSetter
- def aruco_markers_group(self, aruco_markers_group: ArUcoMarkersGroup.ArUcoMarkersGroup):
+ def aruco_markers_group(self, aruco_markers_group: ArUcoMarkerGroup.ArUcoMarkerGroup):
self.__aruco_markers_group = aruco_markers_group
@@ -117,7 +117,7 @@ class ArUcoScene(ArFeatures.ArScene):
Parameters:
image: where to draw
- draw_aruco_markers_group: ArUcoMarkersGroup.draw parameters (if None, no group drawn)
+ draw_aruco_markers_group: ArUcoMarkerGroup.draw parameters (if None, no group drawn)
"""
# Draw group if required
diff --git a/src/argaze/ArUcoMarker/__init__.py b/src/argaze/ArUcoMarker/__init__.py
new file mode 100644
index 0000000..f297c0d
--- /dev/null
+++ b/src/argaze/ArUcoMarker/__init__.py
@@ -0,0 +1,6 @@
+"""
+Handle [OpenCV ArUco markers](https://docs.opencv.org/4.x/d5/dae/tutorial_aruco_detection.html): generate and detect
+markers, calibrate camera, describe scene, ...
+"""
+__all__ = ['ArUcoMarkerDictionary', 'ArUcoMarker', 'ArUcoBoard', 'ArUcoOpticCalibrator', 'ArUcoDetector',
+ 'ArUcoMarkerGroup', 'ArUcoCamera', 'ArUcoScene', 'utils']
diff --git a/src/argaze/ArUcoMarkers/utils/A3_DICT_APRILTAG_16h5_3cm_35cmx25cm.pdf b/src/argaze/ArUcoMarker/utils/A3_DICT_APRILTAG_16h5_3cm_35cmx25cm.pdf
index 2adcee1..2adcee1 100644
--- a/src/argaze/ArUcoMarkers/utils/A3_DICT_APRILTAG_16h5_3cm_35cmx25cm.pdf
+++ b/src/argaze/ArUcoMarker/utils/A3_DICT_APRILTAG_16h5_3cm_35cmx25cm.pdf
Binary files differ
diff --git a/src/argaze/ArUcoMarkers/utils/A4_DICT_APRILTAG_16h5_5cm_0-7.pdf b/src/argaze/ArUcoMarker/utils/A4_DICT_APRILTAG_16h5_5cm_0-7.pdf
index fcf850d..fcf850d 100644
--- a/src/argaze/ArUcoMarkers/utils/A4_DICT_APRILTAG_16h5_5cm_0-7.pdf
+++ b/src/argaze/ArUcoMarker/utils/A4_DICT_APRILTAG_16h5_5cm_0-7.pdf
Binary files differ
diff --git a/src/argaze/ArUcoMarkers/utils/__init__.py b/src/argaze/ArUcoMarker/utils/__init__.py
index 923f5ec..923f5ec 100644
--- a/src/argaze/ArUcoMarkers/utils/__init__.py
+++ b/src/argaze/ArUcoMarker/utils/__init__.py
diff --git a/src/argaze/ArUcoMarkers/__init__.py b/src/argaze/ArUcoMarkers/__init__.py
deleted file mode 100644
index b7b0bf8..0000000
--- a/src/argaze/ArUcoMarkers/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-"""
-Handle [OpenCV ArUco markers](https://docs.opencv.org/4.x/d5/dae/tutorial_aruco_detection.html): generate and detect
-markers, calibrate camera, describe scene, ...
-"""
-__all__ = ['ArUcoMarkersDictionary', 'ArUcoMarker', 'ArUcoBoard', 'ArUcoOpticCalibrator', 'ArUcoDetector',
- 'ArUcoMarkersGroup', 'ArUcoCamera', 'ArUcoScene', 'utils']
diff --git a/src/argaze/__init__.py b/src/argaze/__init__.py
index 2e004f1..a07fa93 100644
--- a/src/argaze/__init__.py
+++ b/src/argaze/__init__.py
@@ -1,7 +1,7 @@
"""
ArGaze is divided in submodules dedicated to various specifics features.
"""
-__all__ = ['ArUcoMarkers', 'AreaOfInterest', 'ArFeatures', 'GazeFeatures', 'GazeAnalysis', 'PupilFeatures', 'PupilAnalysis', 'DataFeatures', 'utils']
+__all__ = ['ArUcoMarker', 'AreaOfInterest', 'ArFeatures', 'GazeFeatures', 'GazeAnalysis', 'PupilFeatures', 'PupilAnalysis', 'DataFeatures', 'utils']
def load(filepath: str) -> any:
"""
diff --git a/src/argaze/utils/aruco_markers_group_export.py b/src/argaze/utils/aruco_markers_group_export.py
deleted file mode 100644
index 569ba6b..0000000
--- a/src/argaze/utils/aruco_markers_group_export.py
+++ /dev/null
@@ -1,234 +0,0 @@
-#!/usr/bin/env python
-
-"""
-
-This program is free software: you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <https://www.gnu.org/licenses/>.
-"""
-
-__author__ = "Théo de la Hogue"
-__credits__ = []
-__copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)"
-__license__ = "GPLv3"
-
-import argparse
-import contextlib
-
-import cv2
-
-from argaze import DataFeatures
-from argaze.ArUcoMarkers import ArUcoDetector, ArUcoOpticCalibrator, ArUcoMarkersGroup
-from argaze.utils import UtilsFeatures
-
-
-def main():
- """
- Detect DICTIONARY and SIZE ArUco markers inside a MOVIE frame then, export detected ArUco markers group as .obj file into an OUTPUT folder.
- """
-
- # Manage arguments
- parser = argparse.ArgumentParser(description=main.__doc__.split('-')[0])
- parser.add_argument('movie', metavar='MOVIE', type=str, default=None, help='movie path')
- parser.add_argument('dictionary', metavar='DICTIONARY', type=str, default=None,
- help='expected ArUco markers dictionary')
- parser.add_argument('size', metavar='SIZE', type=float, default=None, help='expected ArUco markers size (in cm)')
-
- parser.add_argument('-p', '--parameters', metavar='PARAMETERS', type=str, default=None,
- help='ArUco detector parameters file')
- parser.add_argument('-op', '--optic_parameters', metavar='OPTIC_PARAMETERS', type=str, default=None,
- help='ArUco detector optic parameters file')
-
- parser.add_argument('-s', '--start', metavar='START', type=float, default=0., help='start time in second')
- parser.add_argument('-o', '--output', metavar='OUTPUT', type=str, default='.', help='export folder path')
- parser.add_argument('-v', '--verbose', action='store_true', default=False,
- help='enable verbose mode to print information in console')
-
- args = parser.parse_args()
-
- # Load movie
- video_capture = cv2.VideoCapture(args.movie)
-
- video_fps = video_capture.get(cv2.CAP_PROP_FPS)
- image_width = int(video_capture.get(cv2.CAP_PROP_FRAME_WIDTH))
- image_height = int(video_capture.get(cv2.CAP_PROP_FRAME_HEIGHT))
-
- # Edit ArUco detector configuration
- configuration = {
- "dictionary": args.dictionary
- }
-
- if args.parameters:
- configuration["parameters"] = args.parameters
-
- if args.optic_parameters:
- configuration["optic_parameters"] = args.optic_parameters
-
- # Load ArUco detector configuration
- aruco_detector = DataFeatures.from_dict(ArUcoDetector.ArUcoDetector, configuration)
-
- if args.verbose:
- print(aruco_detector)
-
- # Create empty ArUco scene
- aruco_markers_group = None
-
- # Edit draw parameters
- draw_parameters = {
- "color": [255, 255, 255],
- "draw_axes": {
- "thickness": 4
- }
- }
-
- # Create a window
- cv2.namedWindow("Export detected ArUco markers", cv2.WINDOW_AUTOSIZE)
-
- # Init image selection
- current_image_index = -1
- _, current_image = video_capture.read()
- next_image_index = int(args.start * video_fps)
- refresh = False
-
- # Waiting for 'ctrl+C' interruption
- with contextlib.suppress(KeyboardInterrupt):
-
- while True:
-
- # Select a new image and detect markers once
- if next_image_index != current_image_index or refresh:
-
- video_capture.set(cv2.CAP_PROP_POS_FRAMES, next_image_index)
-
- success, video_image = video_capture.read()
-
- video_height, video_width, _ = video_image.shape
-
- # Create default optic parameters adapted to frame size
- if aruco_detector.optic_parameters is None:
- # Note: The choice of 1000 for default focal length should be discussed...
- aruco_detector.optic_parameters = ArUcoOpticCalibrator.OpticParameters(rms=-1, dimensions=(
- video_width, video_height), K=ArUcoOpticCalibrator.K0(focal_length=(1000., 1000.),
- width=video_width, height=video_height))
-
- if success:
-
- # Refresh once
- refresh = False
-
- current_image_index = video_capture.get(cv2.CAP_PROP_POS_FRAMES) - 1
- current_image_time = video_capture.get(cv2.CAP_PROP_POS_MSEC)
-
- try:
-
- # Detect and project AR features
- aruco_detector.detect_markers(video_image)
-
- # Estimate all detected markers pose
- aruco_detector.estimate_markers_pose(args.size)
-
- # Build aruco scene from detected markers
- aruco_markers_group = ArUcoMarkersGroup.ArUcoMarkersGroup(aruco_detector.dictionary,
- aruco_detector.detected_markers())
-
- # Detection succeeded
- exception = None
-
- # Write errors
- except Exception as e:
-
- aruco_markers_group = None
-
- exception = e
-
- # Draw detected markers
- aruco_detector.draw_detected_markers(video_image, draw_parameters)
-
- # Write detected markers
- cv2.putText(video_image, f'Detecting markers {list(aruco_detector.detected_markers().keys())}',
- (20, video_height - 40), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 1, cv2.LINE_AA)
-
- # Write timing
- cv2.putText(video_image, f'Frame at {int(current_image_time)}ms', (20, 40),
- cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 1, cv2.LINE_AA)
-
- # Write exception
- if exception is not None:
- cv2.putText(video_image, f'error: {exception}', (20, 80), cv2.FONT_HERSHEY_SIMPLEX, 1,
- (0, 255, 255), 1, cv2.LINE_AA)
-
- # Write documentation
- cv2.putText(video_image, f'<- previous image', (video_width - 500, video_height - 160),
- cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv2.LINE_AA)
- cv2.putText(video_image, f'-> next image', (video_width - 500, video_height - 120),
- cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv2.LINE_AA)
- cv2.putText(video_image, f'r: reload config', (video_width - 500, video_height - 80),
- cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv2.LINE_AA)
- cv2.putText(video_image, f'Ctrl+s: export ArUco markers', (video_width - 500, video_height - 40),
- cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv2.LINE_AA)
-
- # Copy image
- current_image = video_image.copy()
-
- # Keep last image
- else:
-
- video_image = current_image.copy()
-
- key_pressed = cv2.waitKey(10)
-
- #if key_pressed != -1:
- # print(key_pressed)
-
- # Select previous image with left arrow
- if key_pressed == 2:
- next_image_index -= 1
-
- # Select next image with right arrow
- if key_pressed == 3:
- next_image_index += 1
-
- # Clip image index
- if next_image_index < 0:
- next_image_index = 0
-
- # r: reload configuration
- if key_pressed == 114:
- aruco_detector = DataFeatures.from_dict(ArUcoDetector.ArUcoDetector, configuration)
- refresh = True
- print('Configuration reloaded')
-
- # Save selected marker edition using 'Ctrl + s'
- if key_pressed == 19:
-
- if aruco_markers_group:
-
- aruco_markers_group.to_obj(f'{args.output}/{int(current_image_time)}-aruco_markers_group.obj')
- print(f'ArUco markers saved into {args.output}')
-
- else:
-
- print(f'No ArUco markers to export')
-
- # Close window using 'Esc' key
- if key_pressed == 27:
- break
-
- # Display video
- cv2.imshow(aruco_detector.name, video_image)
-
- # Close movie capture
- video_capture.release()
-
- # Stop image display
- cv2.destroyAllWindows()
-
-
-if __name__ == '__main__':
- main()
diff --git a/src/argaze/utils/demo/aruco_markers_pipeline.json b/src/argaze/utils/demo/aruco_markers_pipeline.json
index b64dde3..48071ab 100644
--- a/src/argaze/utils/demo/aruco_markers_pipeline.json
+++ b/src/argaze/utils/demo/aruco_markers_pipeline.json
@@ -1,5 +1,5 @@
{
- "argaze.ArUcoMarkers.ArUcoCamera.ArUcoCamera": {
+ "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": {
"name": "Head-mounted camera",
"size": [1920, 1080],
"aruco_detector": {