Skip to content

Commit ca73978

Browse files
committed
Initial YOLO implementation
1 parent 11b9f66 commit ca73978

File tree

1 file changed

+35
-0
lines changed
  • people_tracking_v2/src/people_tracking

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)