aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py35
1 files changed, 2 insertions, 33 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py b/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py
index edae927..b4aedbd 100644
--- a/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py
+++ b/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py
@@ -432,11 +432,7 @@ class ArUcoMarkersGroup():
try:
- T = self.places[identifier].translation
- R = self.places[identifier].rotation
-
- placePoints = (T + numpy.float32([R.dot([-l, -l, 0]), R.dot([l, -l, 0]), R.dot([l, l, 0]), R.dot([-l, l, 0])])).reshape(-1, 3)
- placePoints, _ = cv2.projectPoints(placePoints, self._rotation, self._translation, numpy.array(K), numpy.array(D))
+ placePoints, _ = cv2.projectPoints(place.corners, self._rotation, self._translation, numpy.array(K), numpy.array(D))
placePoints = placePoints.astype(int)
cv2.line(image, tuple(placePoints[0].ravel()), tuple(placePoints[1].ravel()), color, border_size)
@@ -448,29 +444,7 @@ class ArUcoMarkersGroup():
except cv2.error:
pass
- def draw_places_axes(self, image: numpy.array, K, D, thickness: int = 0, length: float = 0):
- """Draw group place axes."""
-
- for identifier, place in self.places.items():
-
- try:
-
- T = self.places[identifier].translation
- R = self.places[identifier].rotation
-
- axisPoints = (T + numpy.float32([R.dot([length, 0, 0]), R.dot([0, length, 0]), R.dot([0, 0, length]), R.dot([0, 0, 0])])).reshape(-1, 3)
- axisPoints, _ = cv2.projectPoints(axisPoints, self._rotation, self._translation, numpy.array(K), numpy.array(D))
- axisPoints = axisPoints.astype(int)
-
- cv2.line(image, tuple(axisPoints[3].ravel()), tuple(axisPoints[0].ravel()), (0, 0, 255), thickness) # X (red)
- cv2.line(image, tuple(axisPoints[3].ravel()), tuple(axisPoints[1].ravel()), (0, 255, 0), thickness) # Y (green)
- cv2.line(image, tuple(axisPoints[3].ravel()), tuple(axisPoints[2].ravel()), (255, 0, 0), thickness) # Z (blue)
-
- # Ignore errors due to out of field places: their coordinate are larger than int32 limitations.
- except cv2.error:
- pass
-
- def draw(self, image: numpy.array, K, D, draw_axes: dict = None, draw_places: dict = None, draw_places_axes: dict = None):
+ def draw(self, image: numpy.array, K, D, draw_axes: dict = None, draw_places: dict = None):
"""Draw group axes and places.
Parameters:
@@ -489,11 +463,6 @@ class ArUcoMarkersGroup():
self.draw_places(image, K, D, **draw_places)
- # Draw places axes if required
- if draw_places_axes is not None:
-
- self.draw_places_axes(image, K, D, **draw_places_axes)
-
def to_obj(self, obj_filepath):
"""Save group to .obj file."""