Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "caliscope"
version = "0.7.0"
version = "0.7.2"
description = "GUI based multicamera calibration that integrates with 2D landmark tracking to triangulate 3D landmark positions"
authors = [{name = "Mac Prible", email = "prible@gmail.com"}]
license = { text = "BSD-2-Clause" }
Expand Down
35 changes: 14 additions & 21 deletions src/caliscope/trackers/charuco_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ def __init__(self, charuco):
# to camera
self.charuco = charuco
self.board = charuco.board
self.dictionary_object = self.charuco.dictionary_object

# CharucoDetector replaces the old free-function API
# (detectMarkers + interpolateCornersCharuco) removed in OpenCV 4.8+
self.detector = cv2.aruco.CharucoDetector(self.board)

# for subpixel corner correction
self.criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.0001)
Expand Down Expand Up @@ -59,19 +62,11 @@ def find_corners_single_frame(self, gray_frame, mirror):
ids = np.array([], dtype=np.int32)
img_loc = np.empty((0, 2), dtype=np.float64)

# detect if aruco markers are present
aruco_corners, aruco_ids, rejected = cv2.aruco.detectMarkers(gray_frame, self.dictionary_object)

# if so, then interpolate to the Charuco Corners and return what you found
if len(aruco_corners) > 3:
(
success,
_img_loc,
_ids,
) = cv2.aruco.interpolateCornersCharuco(aruco_corners, aruco_ids, gray_frame, self.board)
# detectBoard combines marker detection + charuco corner interpolation
_img_loc, _ids, marker_corners, marker_ids = self.detector.detectBoard(gray_frame)

# This occasionally errors out...
# only offers possible refinement so if it fails, just move along
if _ids is not None and len(_ids) > 0:
# Sub-pixel refinement — occasionally errors out, so just move along if it fails
try:
_img_loc = cv2.cornerSubPix(
gray_frame,
Expand All @@ -83,15 +78,13 @@ def find_corners_single_frame(self, gray_frame, mirror):
except Exception as e:
logger.debug(f"Sub pixel detection failed: {e}")

if success:
# assign to tracker
ids = _ids[:, 0]
img_loc = _img_loc[:, 0]
ids = _ids[:, 0]
img_loc = _img_loc[:, 0]

# flip coordinates if mirrored image fed in
frame_width = gray_frame.shape[1] # used for flipping mirrored corners back
if mirror:
img_loc[:, 0] = frame_width - img_loc[:, 0]
# flip coordinates if mirrored image fed in
frame_width = gray_frame.shape[1]
if mirror:
img_loc[:, 0] = frame_width - img_loc[:, 0]

return ids, img_loc

Expand Down
94 changes: 94 additions & 0 deletions src/caliscope/trackers/model_cards/rtmpose_l_halpe26.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
[model]
name = "RTMPose-l Halpe26"
model_path = "rtmpose_l_halpe26.onnx"
format = "simcc"
input_size = [192, 256]
confidence_threshold = 0.3

[source]
url = "https://download.openmmlab.com/mmpose/v1/projects/rtmposev1/onnx_sdk/rtmpose-l_simcc-body7_pt-body7-halpe26_700e-256x192-2abb7558_20230605.zip"
extraction = "zip_end2end"
license = "Apache-2.0"
license_url = "https://github.com/open-mmlab/mmpose/blob/main/LICENSE"
file_size_mb = 100
sha256 = "5a30a83a9836b3cb0c1b036ca905eac9e21e9a5c795f5301a8f4843fb7ad76ba"

[points]
nose = 0
left_eye = 1
right_eye = 2
left_ear = 3
right_ear = 4
left_shoulder = 5
right_shoulder = 6
left_elbow = 7
right_elbow = 8
left_wrist = 9
right_wrist = 10
left_hip = 11
right_hip = 12
left_knee = 13
right_knee = 14
left_ankle = 15
right_ankle = 16
head = 17
neck = 18
hip = 19
left_big_toe = 20
right_big_toe = 21
left_small_toe = 22
right_small_toe = 23
left_heel = 24
right_heel = 25

[segments.shoulders]
color = "y"
points = ["left_shoulder", "right_shoulder"]

[segments.left_arm]
color = "g"
points = ["left_shoulder", "left_elbow"]

[segments.left_forearm]
color = "g"
points = ["left_elbow", "left_wrist"]

[segments.right_arm]
color = "r"
points = ["right_shoulder", "right_elbow"]

[segments.right_forearm]
color = "r"
points = ["right_elbow", "right_wrist"]

[segments.pelvis]
color = "y"
points = ["left_hip", "right_hip"]

[segments.left_flank]
color = "y"
points = ["left_hip", "left_shoulder"]

[segments.right_flank]
color = "y"
points = ["right_hip", "right_shoulder"]

[segments.left_thigh]
color = "g"
points = ["left_hip", "left_knee"]

[segments.left_shank]
color = "g"
points = ["left_knee", "left_ankle"]

[segments.right_thigh]
color = "r"
points = ["right_hip", "right_knee"]

[segments.right_shank]
color = "r"
points = ["right_knee", "right_ankle"]

[segments.neck_segment]
color = "y"
points = ["neck", "head"]
94 changes: 94 additions & 0 deletions src/caliscope/trackers/model_cards/rtmpose_x_halpe26.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
[model]
name = "RTMPose-x Halpe26"
model_path = "rtmpose_x_halpe26.onnx"
format = "simcc"
input_size = [288, 384]
confidence_threshold = 0.3

[source]
url = "https://download.openmmlab.com/mmpose/v1/projects/rtmposev1/onnx_sdk/rtmpose-x_simcc-body7_pt-body7-halpe26_700e-384x288-7fb6e239_20230606.zip"
extraction = "zip_end2end"
license = "Apache-2.0"
license_url = "https://github.com/open-mmlab/mmpose/blob/main/LICENSE"
file_size_mb = 178
sha256 = "0c33d9ba030e7011686e6a7f48fd85df383378216f2f5765ae389c1828685e68"

[points]
nose = 0
left_eye = 1
right_eye = 2
left_ear = 3
right_ear = 4
left_shoulder = 5
right_shoulder = 6
left_elbow = 7
right_elbow = 8
left_wrist = 9
right_wrist = 10
left_hip = 11
right_hip = 12
left_knee = 13
right_knee = 14
left_ankle = 15
right_ankle = 16
head = 17
neck = 18
hip = 19
left_big_toe = 20
right_big_toe = 21
left_small_toe = 22
right_small_toe = 23
left_heel = 24
right_heel = 25

[segments.shoulders]
color = "y"
points = ["left_shoulder", "right_shoulder"]

[segments.left_arm]
color = "g"
points = ["left_shoulder", "left_elbow"]

[segments.left_forearm]
color = "g"
points = ["left_elbow", "left_wrist"]

[segments.right_arm]
color = "r"
points = ["right_shoulder", "right_elbow"]

[segments.right_forearm]
color = "r"
points = ["right_elbow", "right_wrist"]

[segments.pelvis]
color = "y"
points = ["left_hip", "right_hip"]

[segments.left_flank]
color = "y"
points = ["left_hip", "left_shoulder"]

[segments.right_flank]
color = "y"
points = ["right_hip", "right_shoulder"]

[segments.left_thigh]
color = "g"
points = ["left_hip", "left_knee"]

[segments.left_shank]
color = "g"
points = ["left_knee", "left_ankle"]

[segments.right_thigh]
color = "r"
points = ["right_hip", "right_knee"]

[segments.right_shank]
color = "r"
points = ["right_knee", "right_ankle"]

[segments.neck_segment]
color = "y"
points = ["neck", "head"]
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading