Latent SVM+DPM 行人检测

这段代码演示了如何利用OpenCV库中的DPMDetector进行行人检测。首先创建了一个DPMDetector对象,加载了'inriaperson.xml'模型文件,然后读取并处理了'1.jpg'图像,检测到行人后用矩形框标出,并显示在'cut'窗口中。程序还计算了检测过程的时间。
摘要由CSDN通过智能技术生成

#include "pch.h" //vs2015 为“stdafx.h”
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/dpm.hpp>
#include <opencv2/dnn/all_layers.hpp>
using namespace cv;
using namespace cv::dpm;//contrip模块
using namespace std;
const string model_path = "inriaperson.xml";//opencv_contrip/modules/dpm/samples/data/中包含 


int main()
{    //通常情况下,在实例化目标时,需要提供级联的检测器的名称

    Ptr<DPMDetector> detector = DPMDetector::create(vector<string>(1, model_path));
    Scalar color(0, 255, 255); 
    Mat frame;

//时间计算
    double t = (double)getTickCount();
    vector<DPMDetector::ObjectDetection> qs;
    Mat image = imread("1.jpg");
    frame = image.clone();
    detector->detect(image, qs);
    t = ((double)getTickCount() - t) / getTickFrequency();
    cout &

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值