void QuickDemo::face_detection_demo() {
std::string root_dir = "D:/opencv-4.4.0/opencv/sources/samples/dnn/face_detector/";
//读取模型+配置文件
dnn::Net net = dnn::readNetFromTensorflow(root_dir+ "opencv_face_detector_uint8.pb", root_dir+"opencv_face_detector.pbtxt");
VideoCapture capture("D:/images/video/example_dsh.mp4");
Mat frame;
while (true) {
capture.read(frame);
if (frame.empty()) {
break;
}
Mat blob = dnn::blobFromImage(frame, 1.0, Size(300, 300), Scalar(104, 177, 123), false, false);
net.setInput(blob);// NCHW
Mat probs = net.forward(); //
Mat detectionMat(probs.size[2], probs.size[3], CV_32F, probs.ptr<float>());
// 解析结果
for (int i = 0; i < detectionMat.rows; i++) {
<