diff --git a/HandTracker.py b/HandTracker.py index d458388..589ac69 100644 --- a/HandTracker.py +++ b/HandTracker.py @@ -431,7 +431,7 @@ def lm_postprocess(self, hand, inference): mat = cv2.getAffineTransform(src, dst) lm_xy = np.expand_dims(hand.norm_landmarks[:,:2], axis=0) # lm_z = hand.norm_landmarks[:,2:3] * hand.rect_w_a / 0.4 - hand.landmarks = np.squeeze(cv2.transform(lm_xy, mat)).astype(np.int) + hand.landmarks = np.squeeze(cv2.transform(lm_xy, mat)).astype(np.int32) # World landmarks if self.use_world_landmarks: diff --git a/HandTrackerBpf.py b/HandTrackerBpf.py index f6b929c..a7edc98 100644 --- a/HandTrackerBpf.py +++ b/HandTrackerBpf.py @@ -489,7 +489,7 @@ def lm_postprocess(self, hand, inference): mat = cv2.getAffineTransform(src, dst) lm_xy = np.expand_dims(hand.norm_landmarks[:,:2], axis=0) # lm_z = hand.norm_landmarks[:,2:3] * hand.rect_w_a / 0.4 - hand.landmarks = np.squeeze(cv2.transform(lm_xy, mat)).astype(np.int) + hand.landmarks = np.squeeze(cv2.transform(lm_xy, mat)).astype(np.int32) # World landmarks if self.use_world_landmarks: diff --git a/HandTrackerBpfEdge.py b/HandTrackerBpfEdge.py index 2939cc7..edc30a2 100644 --- a/HandTrackerBpfEdge.py +++ b/HandTrackerBpfEdge.py @@ -483,7 +483,7 @@ def extract_hand_data(self, res, hand_idx): hand.handedness = res["handedness"][hand_idx] hand.label = "right" if hand.handedness > 0.5 else "left" hand.norm_landmarks = np.array(res['rrn_lms'][hand_idx]).reshape(-1,3) - hand.landmarks = (np.array(res["sqn_lms"][hand_idx]) * self.frame_size).reshape(-1,2).astype(np.int) + hand.landmarks = (np.array(res["sqn_lms"][hand_idx]) * self.frame_size).reshape(-1,2).astype(np.int32) if self.xyz: hand.xyz = np.array(res["xyz"][hand_idx]) hand.xyz_zone = res["xyz_zone"][hand_idx] diff --git a/HandTrackerEdge.py b/HandTrackerEdge.py index d8b0d3a..acef943 100644 --- a/HandTrackerEdge.py +++ b/HandTrackerEdge.py @@ -430,7 +430,7 @@ def extract_hand_data(self, res, hand_idx): hand.handedness = res["handedness"][hand_idx] hand.label = "right" if hand.handedness > 0.5 else "left" hand.norm_landmarks = np.array(res['rrn_lms'][hand_idx]).reshape(-1,3) - hand.landmarks = (np.array(res["sqn_lms"][hand_idx]) * self.frame_size).reshape(-1,2).astype(np.int) + hand.landmarks = (np.array(res["sqn_lms"][hand_idx]) * self.frame_size).reshape(-1,2).astype(np.int32) if self.xyz: hand.xyz = np.array(res["xyz"][hand_idx]) hand.xyz_zone = res["xyz_zone"][hand_idx] diff --git a/HandTrackerRenderer.py b/HandTrackerRenderer.py index 9294714..c424b1b 100644 --- a/HandTrackerRenderer.py +++ b/HandTrackerRenderer.py @@ -65,7 +65,7 @@ def draw_hand(self, hand): if self.show_rot_rect: cv2.polylines(self.frame, [np.array(hand.rect_points)], True, (0,255,255), 2, cv2.LINE_AA) if self.show_landmarks: - lines = [np.array([hand.landmarks[point] for point in line]).astype(np.int) for line in LINES_HAND] + lines = [np.array([hand.landmarks[point] for point in line]).astype(np.int32) for line in LINES_HAND] if self.show_handedness == 3: color = (0,255,0) if hand.handedness > 0.5 else (0,0,255) else: diff --git a/examples/3d_visualization/demo.py b/examples/3d_visualization/demo.py index e48968e..e5dfc75 100755 --- a/examples/3d_visualization/demo.py +++ b/examples/3d_visualization/demo.py @@ -73,7 +73,7 @@ def __init__(self, tracker, mode_3d="image", smoothing=True): def draw_hand(self, hand, i): if self.mode_3d == "image": # Denormalize z-component of 'norm_landmarks' - lm_z = (hand.norm_landmarks[:,2:3] * hand.rect_w_a / 0.4).astype(np.int) + lm_z = (hand.norm_landmarks[:,2:3] * hand.rect_w_a / 0.4).astype(np.int32) # ... and concatenates with x and y components of 'landmarks' points = np.hstack((hand.landmarks, lm_z)) radius = hand.rect_w_a / 30 # Thickness of segments depends on the hand size diff --git a/mediapipe_utils.py b/mediapipe_utils.py index 84add54..84e2ac8 100644 --- a/mediapipe_utils.py +++ b/mediapipe_utils.py @@ -592,8 +592,8 @@ def __init__(self, scores=None, keypoints_norm=None, keypoints=None, score_thres self.score_thresh = score_thresh self.crop_region = crop_region self.next_crop_region = next_crop_region - # self.keypoints_square = (self.keypoints_norm * self.crop_region.size).astype(np.int) - self.keypoints = (np.array([self.crop_region.xmin, self.crop_region.ymin]) + self.keypoints_norm * self.crop_region.size).astype(np.int) + # self.keypoints_square = (self.keypoints_norm * self.crop_region.size).astype(np.int32) + self.keypoints = (np.array([self.crop_region.xmin, self.crop_region.ymin]) + self.keypoints_norm * self.crop_region.size).astype(np.int32) def print(self): attrs = vars(self)