Mercurial Hosting > traffic-intelligence
diff c/feature-based-tracking.cpp @ 193:a728fce85881
simple test of adding and using default HoG pedestrian detector
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 12 Dec 2011 15:44:54 -0500 |
parents | 0e60a306d324 |
children | 09c7881073f3 |
line wrap: on
line diff
--- a/c/feature-based-tracking.cpp Mon Dec 12 02:05:26 2011 -0500 +++ b/c/feature-based-tracking.cpp Mon Dec 12 15:44:54 2011 -0500 @@ -12,6 +12,7 @@ #include "opencv2/video/tracking.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/highgui/highgui.hpp" +#include "opencv2/objdetect/objdetect.hpp" #include <boost/shared_ptr.hpp> #include <boost/foreach.hpp> @@ -138,6 +139,9 @@ vector<FeatureTrajectoryPtr> lostFeatures; vector<FeaturePointMatch> featurePointMatches; + HOGDescriptor hog; + hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector()); + int key = '?'; unsigned int savedFeatureId=0; Mat frame, currentFrameBW, previousFrameBW; @@ -199,6 +203,11 @@ if (params.display) { BOOST_FOREACH(FeaturePointMatch fp, featurePointMatches) fp.feature->draw(frame, invHomography, Colors::red()); + // object detection + // vector<Rect> locations; + // hog.detectMultiScale(frame, locations, 0, Size(8,8), Size(32,32), 1.05, 2); + // BOOST_FOREACH(Rect r, locations) + // rectangle(frame, r.tl(), r.br(), cv::Scalar(0,255,0), 3); } //drawOpticalFlow(prevPts, currPts, status, frame);