Skip to content

Commit

Permalink
Multiple simultaneous detections
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguelmelon committed May 22, 2024
1 parent e177eb2 commit db4f437
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions people_tracking_v2/scripts/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ def image_callback(self, data):
detection_array.detections.append(detection)

# Draw bounding boxes and labels on the frame (optional)
x1, y1, x2, y2 = map(int, box)
color = (0, 255, 0) # Set your desired color for bounding boxes
thickness = 3
cv2.rectangle(cv_image, (x1, y1), (x2, y2), color, thickness)
cv2.putText(
cv_image, f'{int(label)}: {score:.2f}', (x1, y1 - 10),
cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 1
)
x1, y1, x2, y2 = map(int, box)
color = (0, 255, 0) # Set your desired color for bounding boxes
thickness = 3
cv2.rectangle(cv_image, (x1, y1), (x2, y2), color, thickness)
cv2.putText(
cv_image, f'{int(label)}: {score:.2f}', (x1, y1 - 10),
cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 1
)

# Publish detection results
self.detection_pub.publish(detection_array)

# Display the frame (optional)
# cv2.imshow("YOLOv8", cv_image)
# cv2.waitKey(3)
cv2.imshow("YOLOv8", cv_image)
cv2.waitKey(3)

def main():
rospy.init_node('yolo_node', anonymous=True)
Expand Down

0 comments on commit db4f437

Please sign in to comment.