aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2024-02-26 13:49:37 +0100
committerThéo de la Hogue2024-02-26 13:49:37 +0100
commitef7782609feadcc22da27a00b34c5546f752cbfc (patch)
tree1976ec49804261c15d68b540dcd2c7bd094a4879 /src
parent5cc9ec620ff94287e7f622c927b5a928588e2a7a (diff)
downloadargaze-ef7782609feadcc22da27a00b34c5546f752cbfc.zip
argaze-ef7782609feadcc22da27a00b34c5546f752cbfc.tar.gz
argaze-ef7782609feadcc22da27a00b34c5546f752cbfc.tar.bz2
argaze-ef7782609feadcc22da27a00b34c5546f752cbfc.tar.xz
Removing default None value for working_directory argument in from_dict classmethod. Refactoring estimate_markers_pose method.
Diffstat (limited to 'src')
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoDetector.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoDetector.py b/src/argaze/ArUcoMarkers/ArUcoDetector.py
index 9f51490..2f05098 100644
--- a/src/argaze/ArUcoMarkers/ArUcoDetector.py
+++ b/src/argaze/ArUcoMarkers/ArUcoDetector.py
@@ -185,7 +185,7 @@ class ArUcoDetector(DataFeatures.PipelineStepObject):
self.__parameters = value
@classmethod
- def from_dict(cls, aruco_detector_data: dict, working_directory: str = None) -> ArUcoDetectorType:
+ def from_dict(cls, aruco_detector_data: dict, working_directory: str) -> ArUcoDetectorType:
"""Load ArUcoDetector attributes from dictionary.
Parameters:
@@ -292,16 +292,21 @@ class ArUcoDetector(DataFeatures.PipelineStepObject):
self.__detected_markers[marker_id] = marker
- def estimate_markers_pose(self, markers_ids: list = []):
- """Estimate pose of current detected markers or of given markers id list."""
+ def estimate_markers_pose(self, size: float, ids: list = []):
+ """Estimate pose detected markers pose considering a marker size.
+
+ Parameters:
+ size: size of markers in centimeters.
+ ids: markers id list to select detected markers.
+ """
# Is there detected markers ?
if len(self.__detected_markers) > 0:
# Select all markers by default
- if len(markers_ids) == 0:
+ if len(ids) == 0:
- markers_ids = self.__detected_markers.keys()
+ ids = self.__detected_markers.keys()
# Prepare data for aruco.estimatePoseSingleMarkers function
selected_markers_corners = tuple()
@@ -309,7 +314,7 @@ class ArUcoDetector(DataFeatures.PipelineStepObject):
for marker_id, marker in self.__detected_markers.items():
- if marker_id in markers_ids:
+ if marker_id in ids:
selected_markers_corners += (marker.corners,)
selected_markers_ids.append(marker_id)
@@ -317,7 +322,7 @@ class ArUcoDetector(DataFeatures.PipelineStepObject):
# Estimate pose of selected markers
if len(selected_markers_corners) > 0:
- markers_rvecs, markers_tvecs, markers_points = aruco.estimatePoseSingleMarkers(selected_markers_corners, self.__marker_size, numpy.array(self.__optic_parameters.K), numpy.array(self.__optic_parameters.D))
+ markers_rvecs, markers_tvecs, markers_points = aruco.estimatePoseSingleMarkers(selected_markers_corners, size, numpy.array(self.__optic_parameters.K), numpy.array(self.__optic_parameters.D))
for i, marker_id in enumerate(selected_markers_ids):