diff options
author | Théo de la Hogue | 2024-04-17 13:32:51 +0200 |
---|---|---|
committer | Théo de la Hogue | 2024-04-17 13:32:51 +0200 |
commit | 4d0de7c804914a55977635ec6bc46beb0cf7808a (patch) | |
tree | b3e40c76052b067723bfc41547b81a38a0da00b2 | |
parent | 9e0e2db258a2a475637813649e81b7e400b17022 (diff) | |
download | argaze-4d0de7c804914a55977635ec6bc46beb0cf7808a.zip argaze-4d0de7c804914a55977635ec6bc46beb0cf7808a.tar.gz argaze-4d0de7c804914a55977635ec6bc46beb0cf7808a.tar.bz2 argaze-4d0de7c804914a55977635ec6bc46beb0cf7808a.tar.xz |
Renaming ArUcoMarkers into ArUcoMarker
-rw-r--r-- | docs/user_guide/aruco_marker_pipeline/advanced_topics/aruco_detector_configuration.md | 6 | ||||
-rw-r--r-- | docs/user_guide/aruco_marker_pipeline/advanced_topics/optic_parameters_calibration.md | 18 | ||||
-rw-r--r-- | docs/user_guide/aruco_marker_pipeline/advanced_topics/scripting.md | 12 | ||||
-rw-r--r-- | docs/user_guide/aruco_marker_pipeline/aoi_3d_frame.md | 20 | ||||
-rw-r--r-- | docs/user_guide/aruco_marker_pipeline/aoi_3d_projection.md | 24 | ||||
-rw-r--r-- | docs/user_guide/aruco_marker_pipeline/aruco_markers_description.md | 10 | ||||
-rw-r--r-- | docs/user_guide/aruco_marker_pipeline/configuration_and_execution.md | 22 | ||||
-rw-r--r-- | docs/user_guide/aruco_marker_pipeline/introduction.md | 10 | ||||
-rw-r--r-- | docs/user_guide/aruco_marker_pipeline/pose_estimation.md | 18 | ||||
-rw-r--r-- | docs/user_guide/utils/ready-made_scripts.md | 2 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/ArUcoBoard.py (renamed from src/argaze.test/ArUcoMarkers/ArUcoBoard.py) | 4 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/ArUcoCamera.py (renamed from src/argaze.test/ArUcoMarkers/ArUcoCamera.py) | 0 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/ArUcoDetector.py (renamed from src/argaze.test/ArUcoMarkers/ArUcoDetector.py) | 4 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/ArUcoMarker.py (renamed from src/argaze.test/ArUcoMarkers/ArUcoMarker.py) | 4 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/ArUcoMarkerDictionary.py (renamed from src/argaze.test/ArUcoMarkers/ArUcoMarkersDictionary.py) | 20 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/ArUcoOpticCalibrator.py (renamed from src/argaze.test/ArUcoMarkers/ArUcoOpticCalibrator.py) | 2 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/ArUcoScene.py (renamed from src/argaze.test/ArUcoMarkers/ArUcoScene.py) | 28 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/__init__.py (renamed from src/argaze.test/ArUcoMarkers/__init__.py) | 0 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/utils/aoi_3d.obj (renamed from src/argaze.test/ArUcoMarkers/utils/aoi_3d.obj) | 0 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/utils/aruco_camera.json (renamed from src/argaze.test/ArUcoMarkers/utils/aruco_camera.json) | 0 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/utils/detector.json (renamed from src/argaze.test/ArUcoMarkers/utils/detector.json) | 0 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/utils/detector_parameters.json (renamed from src/argaze.test/ArUcoMarkers/utils/detector_parameters.json) | 0 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/utils/full_hd_board.png (renamed from src/argaze.test/ArUcoMarkers/utils/full_hd_board.png) | bin | 18475 -> 18475 bytes | |||
-rw-r--r-- | src/argaze.test/ArUcoMarker/utils/full_hd_marker.png (renamed from src/argaze.test/ArUcoMarkers/utils/full_hd_marker.png) | bin | 116210 -> 116210 bytes | |||
-rw-r--r-- | src/argaze.test/ArUcoMarker/utils/optic_parameters.json (renamed from src/argaze.test/ArUcoMarkers/utils/optic_parameters.json) | 0 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/utils/scene.json (renamed from src/argaze.test/ArUcoMarkers/utils/scene.json) | 0 | ||||
-rw-r--r-- | src/argaze.test/ArUcoMarker/utils/scene.obj (renamed from src/argaze.test/ArUcoMarkers/utils/scene.obj) | 2 | ||||
-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__.py | 6 | ||||
-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) | bin | 97542 -> 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) | bin | 37670 -> 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__.py | 6 | ||||
-rw-r--r-- | src/argaze/__init__.py | 2 | ||||
-rw-r--r-- | src/argaze/utils/aruco_markers_group_export.py | 234 | ||||
-rw-r--r-- | src/argaze/utils/demo/aruco_markers_pipeline.json | 2 |
43 files changed, 135 insertions, 369 deletions
diff --git a/docs/user_guide/aruco_marker_pipeline/advanced_topics/aruco_detector_configuration.md b/docs/user_guide/aruco_marker_pipeline/advanced_topics/aruco_detector_configuration.md index 7d666ba..53c137a 100644 --- a/docs/user_guide/aruco_marker_pipeline/advanced_topics/aruco_detector_configuration.md +++ b/docs/user_guide/aruco_marker_pipeline/advanced_topics/aruco_detector_configuration.md @@ -5,13 +5,13 @@ As explain in [OpenCV ArUco documentation](https://docs.opencv.org/4.x/d1/dcd/st ## Load ArUcoDetector parameters -[ArUcoCamera.detector.parameters](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoDetector.Parameters) can be loaded thanks to a dedicated JSON entry. +[ArUcoCamera.detector.parameters](../../../argaze.md/#argaze.ArUcoMarker.ArUcoDetector.Parameters) can be loaded thanks to a dedicated JSON entry. -Here is an extract from the JSON [ArUcoCamera](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) configuration file with ArUco detector parameters: +Here is an extract from the JSON [ArUcoCamera](../../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) configuration file with ArUco detector parameters: ```json { - "argaze.ArUcoMarkers.ArUcoCamera.ArUcoCamera": { + "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": { "name": "My FullHD camera", "size": [1920, 1080], "aruco_detector": { diff --git a/docs/user_guide/aruco_marker_pipeline/advanced_topics/optic_parameters_calibration.md b/docs/user_guide/aruco_marker_pipeline/advanced_topics/optic_parameters_calibration.md index 54d0c94..7bbfc63 100644 --- a/docs/user_guide/aruco_marker_pipeline/advanced_topics/optic_parameters_calibration.md +++ b/docs/user_guide/aruco_marker_pipeline/advanced_topics/optic_parameters_calibration.md @@ -7,13 +7,13 @@ A camera device have to be calibrated to compensate its optical distorsion. ## Print calibration board -The first step to calibrate a camera is to create an [ArUcoBoard](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoBoard) like in the code below: +The first step to calibrate a camera is to create an [ArUcoBoard](../../../argaze.md/#argaze.ArUcoMarker.ArUcoBoard) like in the code below: ```python -from argaze.ArUcoMarkers import ArUcoMarkersDictionary, ArUcoBoard +from argaze.ArUcoMarker import ArUcoMarkerDictionary, ArUcoBoard # Create ArUco dictionary -aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary('DICT_APRILTAG_16h5') +aruco_dictionary = ArUcoMarkerDictionary.ArUcoMarkerDictionary('DICT_APRILTAG_16h5') # Create an ArUco board of 7 columns and 5 rows with 5 cm squares with 3cm ArUco markers inside aruco_board = ArUcoBoard.ArUcoBoard(7, 5, 5, 3, aruco_dictionary) @@ -23,13 +23,13 @@ aruco_board.save('./calibration_board.png', 300) ``` !!! note - There is **A3_DICT_APRILTAG_16h5_3cm_35cmx25cm.pdf** file located in *./src/argaze/ArUcoMarkers/utils/* folder ready to be printed on A3 paper sheet. + There is **A3_DICT_APRILTAG_16h5_3cm_35cmx25cm.pdf** file located in *./src/argaze/ArUcoMarker/utils/* folder ready to be printed on A3 paper sheet. Let's print the calibration board before to go further. ## Capture board pictures -Then, the calibration process needs to make many different captures of an [ArUcoBoard](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoBoard) through the camera and then, pass them to an [ArUcoDetector](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoDetector.ArUcoDetector) instance to detect board corners and store them as calibration data into an [ArUcoOpticCalibrator](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoOpticCalibrator) for final calibration process. +Then, the calibration process needs to make many different captures of an [ArUcoBoard](../../../argaze.md/#argaze.ArUcoMarker.ArUcoBoard) through the camera and then, pass them to an [ArUcoDetector](../../../argaze.md/#argaze.ArUcoMarker.ArUcoDetector.ArUcoDetector) instance to detect board corners and store them as calibration data into an [ArUcoOpticCalibrator](../../../argaze.md/#argaze.ArUcoMarker.ArUcoOpticCalibrator) for final calibration process. ![Calibration step](../../../img/optic_calibration_step.png) @@ -42,10 +42,10 @@ The sample of code below illustrates how to: * finally, save optic parameters into a JSON file. ```python -from argaze.ArUcoMarkers import ArUcoMarkersDictionary, ArUcoOpticCalibrator, ArUcoBoard, ArUcoDetector +from argaze.ArUcoMarker import ArUcoMarkerDictionary, ArUcoOpticCalibrator, ArUcoBoard, ArUcoDetector # Create ArUco dictionary -aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary('DICT_APRILTAG_16h5') +aruco_dictionary = ArUcoMarkerDictionary.ArUcoMarkerDictionary('DICT_APRILTAG_16h5') # Create ArUco optic calibrator aruco_optic_calibrator = ArUcoOpticCalibrator.ArUcoOpticCalibrator() @@ -134,9 +134,9 @@ Below, an optic_parameters JSON file example: ## Load and display optic parameters -[ArUcoCamera.detector.optic_parameters](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoOpticCalibrator.OpticParameters) can be enabled thanks to a dedicated JSON entry. +[ArUcoCamera.detector.optic_parameters](../../../argaze.md/#argaze.ArUcoMarker.ArUcoOpticCalibrator.OpticParameters) can be enabled thanks to a dedicated JSON entry. -Here is an extract from the JSON [ArUcoCamera](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) configuration file where optic parameters are loaded and displayed: +Here is an extract from the JSON [ArUcoCamera](../../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) configuration file where optic parameters are loaded and displayed: ```json { diff --git a/docs/user_guide/aruco_marker_pipeline/advanced_topics/scripting.md b/docs/user_guide/aruco_marker_pipeline/advanced_topics/scripting.md index c9a06a6..4d5d44c 100644 --- a/docs/user_guide/aruco_marker_pipeline/advanced_topics/scripting.md +++ b/docs/user_guide/aruco_marker_pipeline/advanced_topics/scripting.md @@ -6,11 +6,11 @@ This could be particularly useful for realtime AR interaction applications. ## Load ArUcoCamera configuration from dictionary -An [ArUcoCamera](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) configuration can be loaded from a Python dictionary. +An [ArUcoCamera](../../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) configuration can be loaded from a Python dictionary. ```python from argaze import DataFeatures -from argaze.ArUcoMarkers import ArUcoCamera +from argaze.ArUcoMarker import ArUcoCamera # Set working directory to enable relative file path loading DataFeatures.set_working_directory('path/to/folder') @@ -59,9 +59,9 @@ with ArUcoCamera.ArUcoCamera(**configuration) as aruco_camera: ## Access to ArUcoCamera and ArScenes attributes -Then, once the configuration is loaded, it is possible to access to its attributes: [read ArUcoCamera code reference](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) to get a complete list of what is available. +Then, once the configuration is loaded, it is possible to access to its attributes: [read ArUcoCamera code reference](../../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) to get a complete list of what is available. -Thus, the [ArUcoCamera.scenes](../../../argaze.md/#argaze.ArFeatures.ArCamera) attribute allows to access each loaded aruco scene and so, access to their attributes: [read ArUcoScene code reference](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) to get a complete list of what is available. +Thus, the [ArUcoCamera.scenes](../../../argaze.md/#argaze.ArFeatures.ArCamera) attribute allows to access each loaded aruco scene and so, access to their attributes: [read ArUcoScene code reference](../../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) to get a complete list of what is available. ```python from argaze import ArFeatures @@ -101,7 +101,7 @@ Let's understand the meaning of each returned data. ### *aruco_camera.aruco_detector.detected_markers()* -A dictionary containing all detected markers provided by [ArUcoDetector](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoDetector) class. +A dictionary containing all detected markers provided by [ArUcoDetector](../../../argaze.md/#argaze.ArUcoMarker.ArUcoDetector) class. ## Setup ArUcoCamera image parameters @@ -133,4 +133,4 @@ aruco_camera_image = aruco_camera.image(**image_parameters) ``` !!! note - [ArUcoCamera](../../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) inherits from [ArFrame](../../../argaze.md/#argaze.ArFeatures.ArFrame) and so, benefits from all image parameters described in [gaze analysis pipeline visualization section](../../gaze_analysis_pipeline/visualization.md).
\ No newline at end of file + [ArUcoCamera](../../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) inherits from [ArFrame](../../../argaze.md/#argaze.ArFeatures.ArFrame) and so, benefits from all image parameters described in [gaze analysis pipeline visualization section](../../gaze_analysis_pipeline/visualization.md).
\ No newline at end of file diff --git a/docs/user_guide/aruco_marker_pipeline/aoi_3d_frame.md b/docs/user_guide/aruco_marker_pipeline/aoi_3d_frame.md index c4514f5..e1614d3 100644 --- a/docs/user_guide/aruco_marker_pipeline/aoi_3d_frame.md +++ b/docs/user_guide/aruco_marker_pipeline/aoi_3d_frame.md @@ -9,11 +9,11 @@ When an 3D AOI of the scene contains others coplanar 3D AOI, like a screen with The [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) class defines a rectangular area where timestamped gaze positions are projected in and inside which they need to be analyzed. -Here is the previous extract where "Left_Screen" and "Right_Screen" AOI are defined as a frame into [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) configuration: +Here is the previous extract where "Left_Screen" and "Right_Screen" AOI are defined as a frame into [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) configuration: ```json { - "argaze.ArUcoMarkers.ArUcoCamera.ArUcoCamera": { + "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": { "name": "My FullHD camera", "size": [1920, 1080], ... @@ -78,7 +78,7 @@ Now, let's understand the meaning of each JSON entry. ### *frames* -An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) instance can contains multiples [ArFrames](../../argaze.md/#argaze.ArFeatures.ArFrame) stored by name. +An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) instance can contains multiples [ArFrames](../../argaze.md/#argaze.ArFeatures.ArFrame) stored by name. ### Left_Screen & Right_Screen @@ -86,21 +86,21 @@ The names of 3D AOI **and** their related [ArFrames](../../argaze.md/#argaze.ArF !!! warning "AOI / Frame names policy" - An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) layer 3D AOI is defined as an [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) frame, **provided they have the same name**. + An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) layer 3D AOI is defined as an [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) frame, **provided they have the same name**. !!! warning "Layer name policy" - An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) frame layer is projected into [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) layer, **provided they have the same name**. + An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) frame layer is projected into [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) layer, **provided they have the same name**. !!! note - [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) frame layers are projected into their dedicated [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) layers when the JSON configuration file is loaded. + [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) frame layers are projected into their dedicated [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) layers when the JSON configuration file is loaded. ## Pipeline execution ### Map ArUcoCamera image into ArUcoScenes frames -After camera image is passed to [ArUcoCamera.watch](../../argaze.md/#argaze.ArFeatures.ArCamera.watch) method, it is possible to apply a perpective transformation in order to project watched image into each [ArUcoScenes](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) [frames background](../../argaze.md/#argaze.ArFeatures.ArFrame) image. +After camera image is passed to [ArUcoCamera.watch](../../argaze.md/#argaze.ArFeatures.ArCamera.watch) method, it is possible to apply a perpective transformation in order to project watched image into each [ArUcoScenes](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) [frames background](../../argaze.md/#argaze.ArFeatures.ArFrame) image. ```python # Assuming that Full HD (1920x1080) timestamped images are available @@ -115,15 +115,15 @@ After camera image is passed to [ArUcoCamera.watch](../../argaze.md/#argaze.ArFe ### Analyse timestamped gaze positions into ArUcoScenes frames -[ArUcoScenes](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) frames benefits from all the services described in [gaze analysis pipeline section](../gaze_analysis_pipeline/introduction.md). +[ArUcoScenes](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) frames benefits from all the services described in [gaze analysis pipeline section](../gaze_analysis_pipeline/introduction.md). !!! note - Timestamped [GazePositions](../../argaze.md/#argaze.GazeFeatures.GazePosition) passed to [ArUcoCamera.look](../../argaze.md/#argaze.ArFeatures.ArFrame.look) method are projected into [ArUcoScenes](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) frames if applicable. + Timestamped [GazePositions](../../argaze.md/#argaze.GazeFeatures.GazePosition) passed to [ArUcoCamera.look](../../argaze.md/#argaze.ArFeatures.ArFrame.look) method are projected into [ArUcoScenes](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) frames if applicable. ### Display each ArUcoScenes frames -All [ArUcoScenes](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) frames image can be displayed as any [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame). +All [ArUcoScenes](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) frames image can be displayed as any [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame). ```python ... diff --git a/docs/user_guide/aruco_marker_pipeline/aoi_3d_projection.md b/docs/user_guide/aruco_marker_pipeline/aoi_3d_projection.md index 306e26a..e0f7f4c 100644 --- a/docs/user_guide/aruco_marker_pipeline/aoi_3d_projection.md +++ b/docs/user_guide/aruco_marker_pipeline/aoi_3d_projection.md @@ -1,7 +1,7 @@ Project 3D AOI into camera frame ================================ -Once [ArUcoScene pose is estimated](pose_estimation.md) and [3D AOI are described](aoi_3d_description.md), AOI can be projected into [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) frame. +Once [ArUcoScene pose is estimated](pose_estimation.md) and [3D AOI are described](aoi_3d_description.md), AOI can be projected into [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) frame. ![3D AOI projection](../../img/aruco_camera_aoi_projection.png) @@ -9,11 +9,11 @@ Once [ArUcoScene pose is estimated](pose_estimation.md) and [3D AOI are describe The [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer) class allows to load 3D AOI description. -Here is the previous extract where one layer is added to [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) configuration: +Here is the previous extract where one layer is added to [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) configuration: ```json { - "argaze.ArUcoMarkers.ArUcoCamera.ArUcoCamera": { + "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": { "name": "My FullHD camera", "size": [1920, 1080], ... @@ -43,7 +43,7 @@ Now, let's understand the meaning of each JSON entry. ### *layers* -An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) instance can contains multiples [ArLayers](../../argaze.md/#argaze.ArFeatures.ArLayer) stored by name. +An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) instance can contains multiples [ArLayers](../../argaze.md/#argaze.ArFeatures.ArLayer) stored by name. ### MyLayer @@ -55,11 +55,11 @@ The set of 3D AOI into the layer as defined at [3D AOI description chapter](aoi_ ## Add ArLayer to ArUcoCamera to project 3D AOI into -Here is the previous extract where one layer is added to [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) configuration and displayed: +Here is the previous extract where one layer is added to [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) configuration and displayed: ```json { - "argaze.ArUcoMarkers.ArUcoCamera.ArUcoCamera": { + "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": { "name": "My FullHD camera", "size": [1920, 1080], ... @@ -110,23 +110,23 @@ The name of an [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer). Basically !!! warning "Layer name policy" - An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) layer is projected into an [ ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) layer, **provided they have the same name**. + An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) layer is projected into an [ ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) layer, **provided they have the same name**. !!! note - [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) layers are projected into their dedicated [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) layers when calling the [ArUcoCamera.watch](../../argaze.md/#argaze.ArFeatures.ArCamera.watch) method. + [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) layers are projected into their dedicated [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) layers when calling the [ArUcoCamera.watch](../../argaze.md/#argaze.ArFeatures.ArCamera.watch) method. ## Add AOI analysis features to ArUcoCamera layer When a scene layer is projected into a camera layer, it means that the 3D scene's AOI are transformed into 2D camera's AOI. -Therefore, it means that [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) benefits from all the services described in [AOI analysis pipeline section](../gaze_analysis_pipeline/aoi_analysis.md). +Therefore, it means that [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) benefits from all the services described in [AOI analysis pipeline section](../gaze_analysis_pipeline/aoi_analysis.md). -Here is the previous extract where AOI matcher, AOI scan path and AOI scan path analyzers are added to the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) layer: +Here is the previous extract where AOI matcher, AOI scan path and AOI scan path analyzers are added to the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) layer: ```json { - "argaze.ArUcoMarkers.ArUcoCamera.ArUcoCamera": { + "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": { "name": "My FullHD camera", "size": [1920, 1080], ... @@ -171,4 +171,4 @@ Here is the previous extract where AOI matcher, AOI scan path and AOI scan path !!! warning - Adding scan path and scan path analyzers to an [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) layer doesn't make sense as the space viewed thru camera frame doesn't necessary reflect the space the gaze is covering. + Adding scan path and scan path analyzers to an [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) layer doesn't make sense as the space viewed thru camera frame doesn't necessary reflect the space the gaze is covering. diff --git a/docs/user_guide/aruco_marker_pipeline/aruco_markers_description.md b/docs/user_guide/aruco_marker_pipeline/aruco_markers_description.md index 66a0581..6da600c 100644 --- a/docs/user_guide/aruco_marker_pipeline/aruco_markers_description.md +++ b/docs/user_guide/aruco_marker_pipeline/aruco_markers_description.md @@ -17,13 +17,13 @@ Many ArUco dictionaries exist with properties concerning the format, the number Here is the documention [about ArUco markers dictionaries](https://docs.opencv.org/3.4/d9/d6a/group__aruco.html#gac84398a9ed9dd01306592dd616c2c975). -The creation of [ArUcoMarkers](../../argaze.md/#argaze.ArUcoMarkers.ArUcoMarker) pictures from a dictionary is illustrated in the code below: +The creation of [ArUcoMarker](../../argaze.md/#argaze.ArUcoMarker.ArUcoMarker) pictures from a dictionary is illustrated in the code below: ```python -from argaze.ArUcoMarkers import ArUcoMarkersDictionary +from argaze.ArUcoMarker import ArUcoMarkerDictionary # Create a dictionary of specific April tags -aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary('DICT_APRILTAG_16h5') +aruco_dictionary = ArUcoMarkerDictionary.ArUcoMarkerDictionary('DICT_APRILTAG_16h5') # Export marker n°5 as 3.5 cm picture with 300 dpi resolution aruco_dictionary.create_marker(5, 3.5).save('./markers/', 300) @@ -33,7 +33,7 @@ aruco_dictionary.save('./markers/', 3.5, 300) ``` !!! note - There is **A4_DICT_APRILTAG_16h5_5cm_0-7.pdf** file located in *./src/argaze/ArUcoMarkers/utils/* folder ready to be printed on A4 paper sheet. + There is **A4_DICT_APRILTAG_16h5_5cm_0-7.pdf** file located in *./src/argaze/ArUcoMarker/utils/* folder ready to be printed on A4 paper sheet. Let's print some of them before to go further. @@ -42,7 +42,7 @@ Let's print some of them before to go further. ## Describe ArUco markers place -Once [ArUcoMarkers](../../argaze.md/#argaze.ArUcoMarkers.ArUcoMarker) pictures are placed into a scene it is possible to describe their 3D places into a file. +Once [ArUcoMarker](../../argaze.md/#argaze.ArUcoMarker.ArUcoMarker) pictures are placed into a scene it is possible to describe their 3D places into a file. ![ArUco markers description](../../img/aruco_markers_description.png) diff --git a/docs/user_guide/aruco_marker_pipeline/configuration_and_execution.md b/docs/user_guide/aruco_marker_pipeline/configuration_and_execution.md index 84877ca..f2bddf8 100644 --- a/docs/user_guide/aruco_marker_pipeline/configuration_and_execution.md +++ b/docs/user_guide/aruco_marker_pipeline/configuration_and_execution.md @@ -1,21 +1,21 @@ Load and execute pipeline ========================= -Once [ArUco markers are placed into a scene](aruco_markers_description.md), they can be detected thanks to [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) class. +Once [ArUco markers are placed into a scene](aruco_markers_description.md), they can be detected thanks to [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) class. -As [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) inherits from [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame), the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) class also benefits from all the services described in [gaze analysis pipeline section](../gaze_analysis_pipeline/introduction.md). +As [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) inherits from [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame), the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) class also benefits from all the services described in [gaze analysis pipeline section](../gaze_analysis_pipeline/introduction.md). ![ArUco camera frame](../../img/aruco_camera_frame.png) ## Load JSON configuration file -An [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) pipeline can be loaded from a JSON configuration file thanks to [argaze.load](../../argaze.md/#argaze.load) package method. +An [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) pipeline can be loaded from a JSON configuration file thanks to [argaze.load](../../argaze.md/#argaze.load) package method. -Here is a simple JSON [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) configuration file example: +Here is a simple JSON [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) configuration file example: ```json { - "argaze.ArUcoMarkers.ArUcoCamera.ArUcoCamera": { + "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": { "name": "My FullHD camera", "size": [1920, 1080], "aruco_detector": { @@ -66,25 +66,25 @@ with argaze.load('./configuration.json') as aruco_camera: Now, let's understand the meaning of each JSON entry. -### argaze.ArUcoMarkers.ArUcoCamera.ArUcoCamera +### argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera The loaded object class name. ### *name - inherited from [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame)* -The name of the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) frame. Basically useful for visualization purpose. +The name of the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) frame. Basically useful for visualization purpose. ### *size - inherited from [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame)* -The size of the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) frame in pixels. Be aware that gaze positions have to be in the same range of value to be projected in. +The size of the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) frame in pixels. Be aware that gaze positions have to be in the same range of value to be projected in. ### *aruco_detector* -The first [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) pipeline step is to detect ArUco markers inside input image. +The first [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) pipeline step is to detect ArUco markers inside input image. ![ArUco markers detection](../../img/aruco_camera_markers_detection.png) -The [ArUcoDetector](../../argaze.md/#argaze.ArUcoMarkers.ArUcoDetector) is in charge to detect all markers from a specific dictionary. +The [ArUcoDetector](../../argaze.md/#argaze.ArUcoMarker.ArUcoDetector) is in charge to detect all markers from a specific dictionary. !!! warning "Mandatory" JSON *aruco_detector* entry is mandatory. @@ -129,7 +129,7 @@ Pass each camera image to [ArUcoCamera.watch](../../argaze.md/#argaze.ArFeatures ### Analyse timestamped gaze positions into camera frame -As mentioned above, [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) inherits from [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) and so, benefits from all the services described in [gaze analysis pipeline section](../gaze_analysis_pipeline/introduction.md). +As mentioned above, [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) inherits from [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) and so, benefits from all the services described in [gaze analysis pipeline section](../gaze_analysis_pipeline/introduction.md). Particularly, timestamped gaze positions can be passed one by one to [ArUcoCamera.look](../../argaze.md/#argaze.ArFeatures.ArFrame.look) method to execute the whole pipeline dedicated to gaze analysis. diff --git a/docs/user_guide/aruco_marker_pipeline/introduction.md b/docs/user_guide/aruco_marker_pipeline/introduction.md index 7e662f7..273de16 100644 --- a/docs/user_guide/aruco_marker_pipeline/introduction.md +++ b/docs/user_guide/aruco_marker_pipeline/introduction.md @@ -3,13 +3,13 @@ Overview This section explains how to build augmented reality pipelines based on [ArUco Markers technology](https://www.sciencedirect.com/science/article/abs/pii/S0031320314000235) for various use cases. -The OpenCV library provides a module to detect fiducial markers into a picture and estimate their poses. +The OpenCV library provides a module to detect fiducial markers in a picture and estimate their poses. ![OpenCV ArUco markers](../../img/opencv_aruco.png) -The ArGaze [ArUcoMarkers submodule](../../argaze.md/#argaze.ArUcoMarkers) eases markers creation, markers detection and 3D scene pose estimation through a set of high level classes. +The ArGaze [ArUcoMarker submodule](../../argaze.md/#argaze.ArUcoMarker) eases markers creation, markers detection, and 3D scene pose estimation through a set of high-level classes. -First, let's look at the schema below: it gives an overview of the main notions involved in the following chapters. +First, let's look at the schema below. It gives an overview of the main notions involved in the following chapters. ![ArUco marker pipeline](../../img/aruco_marker_pipeline.png) @@ -18,7 +18,7 @@ To build your own ArUco marker pipeline, you need to know: * [How to setup ArUco markers into a scene](aruco_markers_description.md), * [How to load and execute ArUco marker pipeline](configuration_and_execution.md), * [How to estimate scene pose](pose_estimation.md), -* [How to describe scene's AOI](aoi_3d_description.md), +* [How to describe a scene's AOI](aoi_3d_description.md), * [How to project 3D AOI into camera frame](aoi_3d_projection.md), * [How to define a 3D AOI as a frame](aoi_3d_frame.md). @@ -26,4 +26,4 @@ More advanced features are also explained like: * [How to script ArUco marker pipeline](advanced_topics/scripting.md), * [How to calibrate optic parameters](advanced_topics/optic_parameters_calibration.md), -* [How to improve ArUco markers detection](advanced_topics/aruco_detector_configuration.md). +* [How to improve ArUco marker detection](advanced_topics/aruco_detector_configuration.md). diff --git a/docs/user_guide/aruco_marker_pipeline/pose_estimation.md b/docs/user_guide/aruco_marker_pipeline/pose_estimation.md index affa232..5ebe783 100644 --- a/docs/user_guide/aruco_marker_pipeline/pose_estimation.md +++ b/docs/user_guide/aruco_marker_pipeline/pose_estimation.md @@ -1,19 +1,19 @@ Estimate scene pose =================== -Once [ArUco markers are placed into a scene](aruco_markers_description.md) and [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) is [configured](configuration_and_execution.md), scene pose can be estimated. +Once [ArUco markers are placed into a scene](aruco_markers_description.md) and [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) is [configured](configuration_and_execution.md), scene pose can be estimated. ![Scene pose estimation](../../img/aruco_camera_pose_estimation.png) ## Add ArUcoScene to ArUcoCamera JSON configuration file -An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) class defines a space with [ArUco markers inside](aruco_markers_description.md) helping to estimate scene pose when they are watched by [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera). +An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) class defines a space with [ArUco markers inside](aruco_markers_description.md) helping to estimate scene pose when they are watched by [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera). -Here is an extract from the JSON [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) configuration file with a sample where one scene is added and displayed: +Here is an extract from the JSON [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) configuration file with a sample where one scene is added and displayed: ```json { - "argaze.ArUcoMarkers.ArUcoCamera.ArUcoCamera": { + "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": { "name": "My FullHD camera", "size": [1920, 1080], ... @@ -67,20 +67,20 @@ Now, let's understand the meaning of each JSON entry. ### *scenes* -An [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) instance can contains multiples [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) stored by name. +An [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) instance can contains multiples [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) stored by name. ### MyScene -The name of an [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene). Basically useful for visualization purpose. +The name of an [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene). Basically useful for visualization purpose. ### *aruco_markers_group* -The 3D places of ArUco markers into the scene as defined at [ArUco markers description chapter](aruco_markers_description.md). Thanks to this description, it is possible to estimate the pose of [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) in [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) frame. +The 3D places of ArUco markers into the scene as defined at [ArUco markers description chapter](aruco_markers_description.md). Thanks to this description, it is possible to estimate the pose of [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) in [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) frame. !!! note - [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) pose estimation is done when calling the [ArUcoCamera.watch](../../argaze.md/#argaze.ArFeatures.ArCamera.watch) method. + [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) pose estimation is done when calling the [ArUcoCamera.watch](../../argaze.md/#argaze.ArFeatures.ArCamera.watch) method. ### *draw_scenes* -The drawing parameters of each loaded [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) in [ArUcoCamera.image](../../argaze.md/#argaze.ArFeatures.ArFrame.image). +The drawing parameters of each loaded [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) in [ArUcoCamera.image](../../argaze.md/#argaze.ArFeatures.ArFrame.image). diff --git a/docs/user_guide/utils/ready-made_scripts.md b/docs/user_guide/utils/ready-made_scripts.md index a7b3057..3640784 100644 --- a/docs/user_guide/utils/ready-made_scripts.md +++ b/docs/user_guide/utils/ready-made_scripts.md @@ -51,5 +51,5 @@ echo "context.resume()" > /tmp/argaze Detect DICTIONARY and SIZE ArUco markers inside a MOVIE frame then, export detected ArUco markers group as .obj file into an OUTPUT folder. ```shell -python ./src/argaze/utils/aruco_markers_group_export.py MOVIE DICTIONARY SIZE -o OUTPUT +python ./src/argaze/utils/aruco_marker_group_export.py MOVIE DICTIONARY SIZE -o OUTPUT ```
\ No newline at end of file diff --git a/src/argaze.test/ArUcoMarkers/ArUcoBoard.py b/src/argaze.test/ArUcoMarker/ArUcoBoard.py index 0bfa568..b20be13 100644 --- a/src/argaze.test/ArUcoMarkers/ArUcoBoard.py +++ b/src/argaze.test/ArUcoMarker/ArUcoBoard.py @@ -19,7 +19,7 @@ __license__ = "GPLv3" import unittest import os -from argaze.ArUcoMarkers import ArUcoBoard, ArUcoMarkersDictionary +from argaze.ArUcoMarker import ArUcoBoard, ArUcoMarkerDictionary import numpy @@ -35,7 +35,7 @@ class TestArUcoBoardClass(unittest.TestCase): marker_size = 1 # Check ArUco board creation - aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary('DICT_APRILTAG_16h5') + aruco_dictionary = ArUcoMarkerDictionary.ArUcoMarkerDictionary('DICT_APRILTAG_16h5') aruco_board = ArUcoBoard.ArUcoBoard(columns, rows, square_size, marker_size, aruco_dictionary) # Check ArUco board dictionary name diff --git a/src/argaze.test/ArUcoMarkers/ArUcoCamera.py b/src/argaze.test/ArUcoMarker/ArUcoCamera.py index eb930ab..eb930ab 100644 --- a/src/argaze.test/ArUcoMarkers/ArUcoCamera.py +++ b/src/argaze.test/ArUcoMarker/ArUcoCamera.py diff --git a/src/argaze.test/ArUcoMarkers/ArUcoDetector.py b/src/argaze.test/ArUcoMarker/ArUcoDetector.py index 62e8a09..40b7d00 100644 --- a/src/argaze.test/ArUcoMarkers/ArUcoDetector.py +++ b/src/argaze.test/ArUcoMarker/ArUcoDetector.py @@ -20,7 +20,7 @@ import unittest import os import math -from argaze.ArUcoMarkers import ArUcoMarkersDictionary, ArUcoOpticCalibrator, ArUcoDetector, ArUcoBoard +from argaze.ArUcoMarker import ArUcoMarkerDictionary, ArUcoOpticCalibrator, ArUcoDetector, ArUcoBoard import cv2 as cv import numpy @@ -63,7 +63,7 @@ class TestArUcoDetectorClass(unittest.TestCase): self.assertEqual(aruco_detector.detected_markers_number(), 0) self.assertEqual(aruco_detector.detected_markers(), {}) - aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary('DICT_APRILTAG_16h5') + aruco_dictionary = ArUcoMarkerDictionary.ArUcoMarkerDictionary('DICT_APRILTAG_16h5') aruco_detector = ArUcoDetector.ArUcoDetector(aruco_dictionary, 5.2) # Check ArUcoDetector creation diff --git a/src/argaze.test/ArUcoMarkers/ArUcoMarker.py b/src/argaze.test/ArUcoMarker/ArUcoMarker.py index de88623..6518c8c 100644 --- a/src/argaze.test/ArUcoMarkers/ArUcoMarker.py +++ b/src/argaze.test/ArUcoMarker/ArUcoMarker.py @@ -18,7 +18,7 @@ __license__ = "GPLv3" import unittest -from argaze.ArUcoMarkers import ArUcoMarkersDictionary, ArUcoMarker +from argaze.ArUcoMarker import ArUcoMarkerDictionary, ArUcoMarker class TestArUcoMarkerClass(unittest.TestCase): """Test ArUcoMarker class.""" @@ -27,7 +27,7 @@ class TestArUcoMarkerClass(unittest.TestCase): """Test ArUcoMarker creation.""" # Check DICT_ARUCO_ORIGINAL ArUcoMarker creation - aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary('DICT_ARUCO_ORIGINAL') + aruco_dictionary = ArUcoMarkerDictionary.ArUcoMarkerDictionary('DICT_ARUCO_ORIGINAL') aruco_marker = aruco_dictionary.create_marker(0, 3) diff --git a/src/argaze.test/ArUcoMarkers/ArUcoMarkersDictionary.py b/src/argaze.test/ArUcoMarker/ArUcoMarkerDictionary.py index 7a5e9e8..2f80a67 100644 --- a/src/argaze.test/ArUcoMarkers/ArUcoMarkersDictionary.py +++ b/src/argaze.test/ArUcoMarker/ArUcoMarkerDictionary.py @@ -18,28 +18,28 @@ __license__ = "GPLv3" import unittest -from argaze.ArUcoMarkers import ArUcoMarkersDictionary +from argaze.ArUcoMarker import ArUcoMarkerDictionary -class TestArUcoMarkersDictionaryClass(unittest.TestCase): - """Test ArUcoMarkersDictionary class.""" +class TestArUcoMarkerDictionaryClass(unittest.TestCase): + """Test ArUcoMarkerDictionary class.""" def test_new(self): - """Test ArUcoMarkersDictionary creation.""" + """Test ArUcoMarkerDictionary creation.""" - # Check that ArUcoMarkersDictionary creation fails with bad name + # Check that ArUcoMarkerDictionary creation fails with bad name with self.assertRaises(NameError): - aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary('BAD_DICT_NAME') + aruco_dictionary = ArUcoMarkerDictionary.ArUcoMarkerDictionary('BAD_DICT_NAME') - # Check default ArUcoMarkersDictionary creation - aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary() + # Check default ArUcoMarkerDictionary creation + aruco_dictionary = ArUcoMarkerDictionary.ArUcoMarkerDictionary() self.assertEqual(aruco_dictionary.name, 'DICT_ARUCO_ORIGINAL') self.assertEqual(aruco_dictionary.format, '5X5') self.assertEqual(aruco_dictionary.number, 1024) - # Check DICT_APRILTAG_16h5 ArUcoMarkersDictionary creation - aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary('DICT_APRILTAG_16h5') + # Check DICT_APRILTAG_16h5 ArUcoMarkerDictionary creation + aruco_dictionary = ArUcoMarkerDictionary.ArUcoMarkerDictionary('DICT_APRILTAG_16h5') self.assertEqual(aruco_dictionary.name, 'DICT_APRILTAG_16h5') self.assertEqual(aruco_dictionary.format, '4X4') diff --git a/src/argaze.test/ArUcoMarkers/ArUcoOpticCalibrator.py b/src/argaze.test/ArUcoMarker/ArUcoOpticCalibrator.py index 79d2ead..d019a5d 100644 --- a/src/argaze.test/ArUcoMarkers/ArUcoOpticCalibrator.py +++ b/src/argaze.test/ArUcoMarker/ArUcoOpticCalibrator.py @@ -19,7 +19,7 @@ __license__ = "GPLv3" import unittest import os -from argaze.ArUcoMarkers import ArUcoOpticCalibrator +from argaze.ArUcoMarker import ArUcoOpticCalibrator import numpy diff --git a/src/argaze.test/ArUcoMarkers/ArUcoScene.py b/src/argaze.test/ArUcoMarker/ArUcoScene.py index f29b1d3..67cb668 100644 --- a/src/argaze.test/ArUcoMarkers/ArUcoScene.py +++ b/src/argaze.test/ArUcoMarker/ArUcoScene.py @@ -20,12 +20,12 @@ import unittest import os import math -from argaze.ArUcoMarkers import ArUcoMarkersGroup, ArUcoMarker +from argaze.ArUcoMarker import ArUcoMarkerGroup, ArUcoMarker import cv2 as cv import numpy -class TestArUcoMarkersGroupClass(unittest.TestCase): +class TestArUcoMarkerGroupClass(unittest.TestCase): def new_from_obj(self): @@ -34,7 +34,7 @@ class TestArUcoMarkersGroupClass(unittest.TestCase): obj_filepath = os.path.join(current_directory, 'utils/scene.obj') # Load file - self.aruco_markers_group = ArUcoMarkersGroup.ArUcoMarkersGroup.from_obj(obj_filepath) + self.aruco_markers_group = ArUcoMarkerGroup.ArUcoMarkerGroup.from_obj(obj_filepath) def new_from_json(self): @@ -43,7 +43,7 @@ class TestArUcoMarkersGroupClass(unittest.TestCase): json_filepath = os.path.join(current_directory, 'utils/scene.json') # Load file - self.aruco_markers_group = ArUcoMarkersGroup.ArUcoMarkersGroup.from_json(json_filepath) + self.aruco_markers_group = ArUcoMarkerGroup.ArUcoMarkerGroup.from_json(json_filepath) def setup_markers(self): @@ -59,12 +59,12 @@ class TestArUcoMarkersGroupClass(unittest.TestCase): self.scene_markers, self.remaining_markers = self.aruco_markers_group.filter_markers(self.detected_markers()) def test_new_from_obj(self): - """Test ArUcoMarkersGroup creation.""" + """Test ArUcoMarkerGroup creation.""" self.new_from_obj() self.setup_markers() - # Check ArUcoMarkersGroup creation + # Check ArUcoMarkerGroup creation self.assertEqual(len(self.aruco_markers_group.places), 3) self.assertIsNone(numpy.testing.assert_array_equal(self.aruco_markers_group.identifiers, [0, 1, 2])) self.assertEqual(self.aruco_markers_group.marker_size, 1.) @@ -82,12 +82,12 @@ class TestArUcoMarkersGroupClass(unittest.TestCase): self.assertIsNone(numpy.testing.assert_array_equal(self.aruco_markers_group.places[2].rotation, [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])) def test_new_from_json(self): - """Test ArUcoMarkersGroup creation.""" + """Test ArUcoMarkerGroup creation.""" self.new_from_json() self.setup_markers() - # Check ArUcoMarkersGroup creation + # Check ArUcoMarkerGroup creation self.assertEqual(len(self.aruco_markers_group.places), 3) self.assertIsNone(numpy.testing.assert_array_equal(self.aruco_markers_group.identifiers, [0, 1, 2])) self.assertEqual(self.aruco_markers_group.marker_size, 1.) @@ -105,7 +105,7 @@ class TestArUcoMarkersGroupClass(unittest.TestCase): self.assertIsNone(numpy.testing.assert_array_equal(self.aruco_markers_group.places[2].rotation, [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])) def test_filter_markers(self): - """Test ArUcoMarkersGroup markers filtering.""" + """Test ArUcoMarkerGroup markers filtering.""" self.new_from_obj() self.setup_markers() @@ -118,7 +118,7 @@ class TestArUcoMarkersGroupClass(unittest.TestCase): self.assertIsNone(numpy.testing.assert_array_equal(list(self.remaining_markers.keys()), [3])) def test_check_markers_consistency(self): - """Test ArUcoMarkersGroup markers consistency checking.""" + """Test ArUcoMarkerGroup markers consistency checking.""" self.new_from_obj() self.setup_markers() @@ -162,7 +162,7 @@ class TestArUcoMarkersGroupClass(unittest.TestCase): self.assertIsNone(numpy.testing.assert_array_equal(list(unconsistencies['translation']['1/2'].keys()), ['current', 'expected'])) def test_estimate_pose_from_single_marker(self): - """Test ArUcoMarkersGroup pose estimation from single marker.""" + """Test ArUcoMarkerGroup pose estimation from single marker.""" self.new_from_obj() self.setup_markers() @@ -178,7 +178,7 @@ class TestArUcoMarkersGroupClass(unittest.TestCase): self.assertIsNone(numpy.testing.assert_array_equal(rmat, [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])) def test_estimate_pose_from_markers(self): - """Test ArUcoMarkersGroup pose estimation from markers.""" + """Test ArUcoMarkerGroup pose estimation from markers.""" self.new_from_obj() self.setup_markers() @@ -199,9 +199,9 @@ class TestArUcoMarkersGroupClass(unittest.TestCase): self.assertIsNone(numpy.testing.assert_array_equal(tvec, [1., 1., 5.])) self.assertIsNone(numpy.testing.assert_array_equal(rmat, [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])) - @unittest.skip("ArUcoMarkersGroup estimate_pose_from_axis_markers method is broken.") + @unittest.skip("ArUcoMarkerGroup estimate_pose_from_axis_markers method is broken.") def test_estimate_pose_from_axis_markers(self): - """Test ArUcoMarkersGroup pose estimation from axis markers.""" + """Test ArUcoMarkerGroup pose estimation from axis markers.""" self.new_from_obj() self.setup_markers() diff --git a/src/argaze.test/ArUcoMarkers/__init__.py b/src/argaze.test/ArUcoMarker/__init__.py index e69de29..e69de29 100644 --- a/src/argaze.test/ArUcoMarkers/__init__.py +++ b/src/argaze.test/ArUcoMarker/__init__.py diff --git a/src/argaze.test/ArUcoMarkers/utils/aoi_3d.obj b/src/argaze.test/ArUcoMarker/utils/aoi_3d.obj index 92e85bd..92e85bd 100644 --- a/src/argaze.test/ArUcoMarkers/utils/aoi_3d.obj +++ b/src/argaze.test/ArUcoMarker/utils/aoi_3d.obj diff --git a/src/argaze.test/ArUcoMarkers/utils/aruco_camera.json b/src/argaze.test/ArUcoMarker/utils/aruco_camera.json index 980dc9f..980dc9f 100644 --- a/src/argaze.test/ArUcoMarkers/utils/aruco_camera.json +++ b/src/argaze.test/ArUcoMarker/utils/aruco_camera.json diff --git a/src/argaze.test/ArUcoMarkers/utils/detector.json b/src/argaze.test/ArUcoMarker/utils/detector.json index 8aada6d..8aada6d 100644 --- a/src/argaze.test/ArUcoMarkers/utils/detector.json +++ b/src/argaze.test/ArUcoMarker/utils/detector.json diff --git a/src/argaze.test/ArUcoMarkers/utils/detector_parameters.json b/src/argaze.test/ArUcoMarker/utils/detector_parameters.json index d26a3fa..d26a3fa 100644 --- a/src/argaze.test/ArUcoMarkers/utils/detector_parameters.json +++ b/src/argaze.test/ArUcoMarker/utils/detector_parameters.json diff --git a/src/argaze.test/ArUcoMarkers/utils/full_hd_board.png b/src/argaze.test/ArUcoMarker/utils/full_hd_board.png Binary files differindex d30b300..d30b300 100644 --- a/src/argaze.test/ArUcoMarkers/utils/full_hd_board.png +++ b/src/argaze.test/ArUcoMarker/utils/full_hd_board.png diff --git a/src/argaze.test/ArUcoMarkers/utils/full_hd_marker.png b/src/argaze.test/ArUcoMarker/utils/full_hd_marker.png Binary files differindex 42146fe..42146fe 100644 --- a/src/argaze.test/ArUcoMarkers/utils/full_hd_marker.png +++ b/src/argaze.test/ArUcoMarker/utils/full_hd_marker.png diff --git a/src/argaze.test/ArUcoMarkers/utils/optic_parameters.json b/src/argaze.test/ArUcoMarker/utils/optic_parameters.json index 988731c..988731c 100644 --- a/src/argaze.test/ArUcoMarkers/utils/optic_parameters.json +++ b/src/argaze.test/ArUcoMarker/utils/optic_parameters.json diff --git a/src/argaze.test/ArUcoMarkers/utils/scene.json b/src/argaze.test/ArUcoMarker/utils/scene.json index bdd9ae8..bdd9ae8 100644 --- a/src/argaze.test/ArUcoMarkers/utils/scene.json +++ b/src/argaze.test/ArUcoMarker/utils/scene.json diff --git a/src/argaze.test/ArUcoMarkers/utils/scene.obj b/src/argaze.test/ArUcoMarker/utils/scene.obj index c233da2..1eb9f81 100644 --- a/src/argaze.test/ArUcoMarkers/utils/scene.obj +++ b/src/argaze.test/ArUcoMarker/utils/scene.obj @@ -1,4 +1,4 @@ -# .OBJ file for ArUcoMarkersGroup unitary test +# .OBJ file for ArUcoMarkerGroup unitary test o DICT_ARUCO_ORIGINAL#0_Marker v -0.500000 -0.500000 0.000000 v 0.500000 -0.500000 0.000000 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 Binary files differindex 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 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 Binary files differindex 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 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": { |