OpenCV reads the image sequence for hog pedestrian detection and saves it as a video __opencv

Source: Internet
Author: User
Tags svm
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;              &

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.