|
|
|
@ -2,13 +2,6 @@ |
|
|
|
|
#include "opencv2/highgui/highgui.hpp" |
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CVCONFIG_H |
|
|
|
|
#include <cvconfig.h> |
|
|
|
|
#endif |
|
|
|
|
#ifdef HAVE_TBB |
|
|
|
|
#include "tbb/task_scheduler_init.h" |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
using namespace cv; |
|
|
|
|
|
|
|
|
|
static void help() |
|
|
|
@ -31,28 +24,13 @@ static void detect_and_draw_objects( IplImage* image, CvLatentSvmDetector* detec |
|
|
|
|
CvSeq* detections = 0; |
|
|
|
|
int i = 0; |
|
|
|
|
int64 start = 0, finish = 0; |
|
|
|
|
#ifdef HAVE_TBB |
|
|
|
|
tbb::task_scheduler_init init(tbb::task_scheduler_init::deferred); |
|
|
|
|
if (numThreads > 0) |
|
|
|
|
{ |
|
|
|
|
init.initialize(numThreads); |
|
|
|
|
printf("Number of threads %i\n", numThreads); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
printf("Number of threads is not correct for TBB version"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
cv::setNumThreads(numThreads); |
|
|
|
|
|
|
|
|
|
start = cvGetTickCount(); |
|
|
|
|
detections = cvLatentSvmDetectObjects(image, detector, storage, 0.5f, numThreads); |
|
|
|
|
finish = cvGetTickCount(); |
|
|
|
|
printf("detection time = %.3f\n", (float)(finish - start) / (float)(cvGetTickFrequency() * 1000000.0)); |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_TBB |
|
|
|
|
init.terminate(); |
|
|
|
|
#endif |
|
|
|
|
for( i = 0; i < detections->total; i++ ) |
|
|
|
|
{ |
|
|
|
|
CvObjectDetection detection = *(CvObjectDetection*)cvGetSeqElem( detections, i ); |
|
|
|
|