【opencv】hog做行人检测

使用opencv中的hog特征来做行人检测

参考 http://blog.csdn.net/icvpr

// hog.cpp : 定义控制台应用程序的入口点。
//

#include 
#include 
#include "highgui.h"
#include "cv.h"


 

#include 
#include 
using namespace std;
using namespace cv;
int main(int argc, char** argv)
{
	VideoCapture capture;
	capture.open("./2.AVI");

	if (!capture.isOpened())
	{
		cout << "capture device failed to open!" << endl;
		return -1;
	}

	Mat frame;
	 while (1)
	 {
		 capture >> frame;
		 if (frame.empty())
		 {
			 std::cout<<"read image failed"< regions;
		 hog.detectMultiScale(frame, regions,  0, cv::Size(8,8), cv::Size(32,32), 1.05, 2);
		 // 显示
		 for (size_t i = 0; i < regions.size(); i++)
		 {
			 cv::rectangle(frame, regions[i], cv::Scalar(0,0,255), 2);
		 }
		 cv::imshow("hog", frame);
		 //cv::waitKey(1);
		 if ( cvWaitKey(1) == 27 )
			 break;
	 }

	return 0;
}



你可能感兴趣的:(OpenCV,Computer,Vision)