# HG changeset patch # User Nicolas Saunier # Date 1323722694 18000 # Node ID a728fce85881131506e077ad51300ad2ecc02097 # Parent 38974d27dd2dd638ded878d91516d742780f5e35 simple test of adding and using default HoG pedestrian detector diff -r 38974d27dd2d -r a728fce85881 c/Makefile --- a/c/Makefile Mon Dec 12 02:05:26 2011 -0500 +++ b/c/Makefile Mon Dec 12 15:44:54 2011 -0500 @@ -20,7 +20,7 @@ ifneq ($(OPENCV), 0) CFLAGS += -DUSE_OPENCV - LDFLAGS += -lopencv_highgui -lopencv_core -lopencv_video -lopencv_ml -lopencv_features2d -lopencv_imgproc + LDFLAGS += -lopencv_highgui -lopencv_core -lopencv_video -lopencv_ml -lopencv_features2d -lopencv_imgproc -lopencv_objdetect endif ifeq ($(UNAME), Linux) diff -r 38974d27dd2d -r a728fce85881 c/feature-based-tracking.cpp --- 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 #include @@ -138,6 +139,9 @@ vector lostFeatures; vector 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 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);