OpenCV Read the image sequence for hog pedestrian detection and saved as a video
http://blog.csdn.net/masibuaa/article/details/16084467
2013-11-13 21:42 4273 People read comments (17) Collection Report Category: Computer Vision (OpenCV) Hog target detection (7)
Copyright NOTICE: This article is the original article of the blogger, without the permission of the blogger may not be reproduced.
This program is used OPENCV default SVM parameters for detection, if the picture too much, processing will be slower.
[CPP] View plain copy #include <stdio.h> #include <iostream> # include <fstream> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> # include <opencv2/objdetect/objdetect.hpp> #include <opencv2/ml/ml.hpp> using namespace std; using namespace cv; Int main () { Mat src; string imgname;//picture file name //ifstream fin ("Seq4List.txt") ;//Open Picture sequence file list ifstream fin ("Subset.txt"); namedwindow ("Imageseq", 0); videowriter videowriter;//Video Recorder videowriter.open ("Seq6.avi", &NBSP;CV_FOURCC (' x ', ' V ', ' I ', ' D '), 25,size (1292,964))//Note If the picture size differs from the writer's size, it may fail if (! Videowriter.isopened ()) cout<< "Create Videowriter failed" <<endl; hogdescriptor people_detect_hog; //hog Feature Detectors // Using the default already trained SVM coefficients as the test model people_detect_hog.setsvmdetector (hogdescriptor:: Getdefaultpeopledetector ()); while ( Getline (fin,imgname)) { cout<< "Handling:" < found, found_filtered; //Rectangular Box Array //of the imported images for multi-scale pedestrian detection, detection window moving step (8,8) people_detect_hog.detectmultiscale (Src, found, 0, size (8), &NBSP;8), size (32, 32), 1.05, 2); //Find all the rectangular boxes that are not nested and put them in the found_filtered, and if there is nesting, take the outer largest rectangle box into the found_filtered for (Int i=0; i < found.size (); i++) { Rect r = found[i]; int j=0; &