wangrong
2025-03-19 291afb9c81aae1d15d9e3edcea618d0a2e1fc5a6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
 
#include "../trt_yolov8_detector.h"
 
int main() {
    trt_yolov8::trt_yolov8_detector detector("./vp_data/models/trt/others/yolov8s_v8.5.engine");
    
    cv::VideoCapture cap("./vp_data/test_video/face2.mp4");
    cv::Mat frame;
    while (true) {
        if (!cap.read(frame)) {
            cap.set(cv::CAP_PROP_POS_FRAMES, 0);
            continue;
        }
        
        std::vector<std::vector<Detection>> detections;
        std::vector<cv::Mat> frames = {frame};
        detector.detect(frames, detections);
 
        draw_bbox(frames, detections);
        cv::imshow("detect", frame);
        cv::waitKey(40);
    }
    return 0;
}