import cv2
from ultralytics import YOLO# 模型加载权重model YOLO(yolov8n.pt)# 视频路径cap cv2.VideoCapture(0)# 对视频中检测到目标画框标出来
while cap.isOpened():# Read a frame from the videosuccess, frame cap.read()if success:# Run YOLOv8 inference on th…
import argparse
import time
import cv2
import numpy as np# 配置参数
ap argparse.ArgumentParser()
ap.add_argument("-v", "--video", typestr,help"path to input video file")
ap.add_argument("-t", "--tracker", …