We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 11b9f66 commit ca73978Copy full SHA for ca73978
people_tracking_v2/src/people_tracking/yolo.py
@@ -0,0 +1,35 @@
1
+#!/usr/bin/env python
2
+
3
+import cv2
4
+from ultralytics import YOLO
5
+import supervision as sv
6
7
8
9
10
11
+def main():
12
+ cap = cv2.VideoCapture(0)
13
14
+ model = YOLO("yolov8l.pt")
15
16
+ box_annotator = sv.BoxAnnotator(
17
+ thickness=2,
18
+ text_thickness=2,
19
+ text_scale=1
20
+ )
21
22
+ while True:
23
+ ret, frame = cap.read()
24
+ cv2.imshow("yolov8", frame)
25
26
+ result = model(frame)[0]
27
+ detections = sv.Detections.from_yolov8(result)
28
29
+ frame = box_annotator.annotate(scene=frame, detections=detections)
30
31
+ if (cv2.waitKey(30) == 27):
32
+ break
33
34
+if __name__ == "__main__":
35
+ main()
0 commit comments