Files
VideoPipe/third_party/trt_yolov8/samples/trt_yolov8_det_test.cpp
2026-06-03 12:43:14 +08:00

25 lines
645 B
C++

#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;
}