fixed axis draw for board center

This commit is contained in:
2025-12-03 17:19:44 +01:00
parent 1d7c3e25bc
commit 89ce7d4337
2 changed files with 6 additions and 2 deletions
+3
View File
@@ -78,6 +78,9 @@ class BoardDetectorAruco(BoardDetector):
# Estimate pose of each marker and return the values r_vec and t_vec---(different from those of camera coefficients)
obj_points, img_points = self.board.matchImagePoints(corners, ids)
offset_w = self.board.getGridSize()[0] * (self.board.getMarkerLength() + self.board.getMarkerSeparation())
offset_h = self.board.getGridSize()[1] * (self.board.getMarkerLength() + self.board.getMarkerSeparation())
obj_points -= [offset_w/2, offset_h/2, 0]
pose, r_vec, t_vec = cv.solvePnP(obj_points, img_points, self.mtx, self.dist, rvec=r_vecs, tvec=t_vecs)
if pose:
# Draw Axis
+3 -2
View File
@@ -76,8 +76,9 @@ class BoardDetectorCharuco(BoardDetector):
if len(charuco_ids) >= len(self.board.getIds()):
obj_points, img_points = self.board.matchImagePoints(charuco_corners, charuco_ids)
offset = int(self.board.getMarkerLength() * self.board.getSquareLength())
obj_points -= [offset, offset, 0]
offset_w = self.board.getChessboardSize()[0] * self.board.getSquareLength()
offset_h = self.board.getChessboardSize()[1] * self.board.getSquareLength()
obj_points -= [offset_w/2, offset_h/2, 0]
if self.is_calibrated():
pose, r_vec, t_vec = cv.solvePnP(obj_points, img_points, self.mtx, self.dist, useExtrinsicGuess=False,
rvec=r_vecs, tvec=t_vecs, flags=cv.SOLVEPNP_ITERATIVE)