赞
踩
以前做算法实现一直用的说matlab,最近做目标跟踪的算法,开始使用Opencv,发现Opencv真的很强大,集合了很多算法,封装了很多函数,使用方法跟matlab很类似,但又比matlab的效率高。下面说我使用hog算法进行人体检测的代码,跟Opencv中的peopledetect.cpp类似,不过我修改了一些代码,可以检测连续的视频序列。
代码如下:
- #include <fstream>
- #include <string>
- #include <cv.h>
- #include <highgui.h>
- #include <ml.h>
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <vector>
- #include "cvaux.h"
- #include <iostream>
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
-
-
- using namespace cv;
- using namespace std;
-
-
- int main()
- {
- Mat img0,img1;
- Mat img2;
- //Mat img3;
- int i;
- FILE* f = 0;
- char _filename[1024];
-
- //imshow("hello",img3);
- //waitKey(0);
- HOGDescriptor hog;
- //CvLatentSvmDetector* detector = cvLoadLatentSvmDetector("result.xml");
- CvSVM svm;
- svm.load("result.xml");
- //h

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。