Skip to content

Commit

Permalink
ROS 2: Added more aruco dicts, fixed aruco linerror bug (#873)
Browse files Browse the repository at this point in the history
Related with this PR in ROS 1
#795

Signed-off-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
ahcorde authored Jan 19, 2024
1 parent 7148a94 commit 3a7bd4c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions camera_calibration/src/camera_calibration/calibrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,22 @@ def __init__(self, pattern="chessboard", n_cols = 0, n_rows = 0, dim = 0.0, mark
if pattern=="charuco":
self.aruco_dict = cv2.aruco.getPredefinedDictionary({
"aruco_orig" : cv2.aruco.DICT_ARUCO_ORIGINAL,
"4x4_50" : cv2.aruco.DICT_4X4_50,
"4x4_100" : cv2.aruco.DICT_4X4_100,
"4x4_250" : cv2.aruco.DICT_4X4_250,
"4x4_1000" : cv2.aruco.DICT_4X4_1000,
"5x5_50" : cv2.aruco.DICT_5X5_50,
"5x5_100" : cv2.aruco.DICT_5X5_100,
"5x5_250" : cv2.aruco.DICT_5X5_250,
"6x6_250" : cv2.aruco.DICT_6X6_250,
"7x7_250" : cv2.aruco.DICT_7X7_250}[aruco_dict])
"5x5_1000" : cv2.aruco.DICT_5X5_1000,
"6x6_50" : cv2.aruco.DICT_6x6_50,
"6x6_100" : cv2.aruco.DICT_6x6_100,
"6x6_250" : cv2.aruco.DICT_6x6_250,
"6x6_1000" : cv2.aruco.DICT_6x6_1000,
"7x7_50" : cv2.aruco.DICT_7x7_50,
"7x7_100" : cv2.aruco.DICT_7x7_100,
"7x7_250" : cv2.aruco.DICT_7x7_250,
"7x7_1000" : cv2.aruco.DICT_7x7_1000}[aruco_dict])
self.charuco_board = cv2.aruco.CharucoBoard_create(self.n_cols, self.n_rows, self.dim, self.marker_size,
self.aruco_dict)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def redraw_monocular(self, drawable):
else:
self.putText(display, "lin.", (width, self.y(0)))
linerror = drawable.linear_error
if linerror < 0:
if linerror is None or linerror < 0:
msg = "?"
else:
msg = "%.2f" % linerror
Expand Down

0 comments on commit 3a7bd4c

Please sign in to comment.