Skip to content

Commit

Permalink
np.ndarray fixed in debug node
Browse files Browse the repository at this point in the history
  • Loading branch information
mgonzs13 committed Jul 21, 2024
1 parent e6ae844 commit 19da2b4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions yolov8_ros/yolov8_ros/debug_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def on_cleanup(self, state: LifecycleState) -> TransitionCallbackReturn:

return TransitionCallbackReturn.SUCCESS

def draw_box(self, cv_image: np.array, detection: Detection, color: Tuple[int]) -> np.array:
def draw_box(self, cv_image: np.ndarray, detection: Detection, color: Tuple[int]) -> np.ndarray:

# get detection info
label = detection.class_name
Expand All @@ -136,7 +136,7 @@ def draw_box(self, cv_image: np.array, detection: Detection, color: Tuple[int])

return cv_image

def draw_mask(self, cv_image: np.array, detection: Detection, color: Tuple[int]) -> np.array:
def draw_mask(self, cv_image: np.ndarray, detection: Detection, color: Tuple[int]) -> np.ndarray:

mask_msg = detection.mask
mask_array = np.array([[int(ele.x), int(ele.y)]
Expand All @@ -150,7 +150,7 @@ def draw_mask(self, cv_image: np.array, detection: Detection, color: Tuple[int])
color=color, thickness=2, lineType=cv2.LINE_AA)
return cv_image

def draw_keypoints(self, cv_image: np.array, detection: Detection) -> np.array:
def draw_keypoints(self, cv_image: np.ndarray, detection: Detection) -> np.ndarray:

keypoints_msg = detection.keypoints

Expand All @@ -163,6 +163,9 @@ def draw_keypoints(self, cv_image: np.array, detection: Detection) -> np.array:

cv2.circle(cv_image, (int(kp.point.x), int(kp.point.y)),
5, color_k, -1, lineType=cv2.LINE_AA)
cv2.putText(cv_image, str(kp.id), (int(kp.point.x), int(kp.point.y)),
cv2.FONT_HERSHEY_SIMPLEX,
1, color_k, 1, cv2.LINE_AA)

def get_pk_pose(kp_id: int) -> Tuple[int]:
for kp in keypoints_msg.data:
Expand Down

0 comments on commit 19da2b4

Please sign in to comment.