Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript

give jon his stuff

Endurance Idehen5360e80c1689
diff --git a/src/core_processor/board_detection/detect.py b/src/core_processor/board_detection/detect.py
index a7b2da30..32f0a019 100644
--- a/src/core_processor/board_detection/detect.py
+++ b/src/core_processor/board_detection/detect.py
@@ -29,3 +29,35 @@ class BoardDetection:
except Exception as e:
print(e)
logger.error(e)
+
+ def detect_charuco_board(self, image):
+ """
+ Charuco base pose estimation.
+ more-or-less copied from - https://mecaruco2.readthedocs.io/en/latest/notebooks_rst/Aruco
+ /sandbox/ludovic/aruco_calibration_rotation.html
+ """
+ charuco_corners = []
+ charuco_ids = []
+
+ # SUB PIXEL CORNER DETECTION CRITERION
+ criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 100, 0.00001)
+
+ gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
+ aruco_square_corners, aruco_square_ids, rejectedImgPoints = cv2.aruco.detectMarkers(gray,
+ aruco_dict)
+
+ if len(aruco_square_corners) > 0:
+ # SUB PIXEL DETECTION
+ for this_corner in aruco_square_corners:
+ cv2.cornerSubPix(gray, this_corner,
+ winSize=(3, 3),
+ zeroZone=(-1, -1),
+ criteria=criteria)
+ res2 = cv2.aruco.interpolateCornersCharuco(aruco_square_corners, aruco_square_ids, gray,
+ board)
+
+ if res2[1] is not None and res2[2] is not None and len(res2[1]) > 3:
+ charuco_corners = res2[1]
+ charuco_ids = res2[2]
+
+ return charuco_corners, charuco_ids, aruco_square_corners, aruco_square_ids