Bugs in the test for LatentSVM were fixed.

This commit is contained in:
Valentina Kustikova
2011-04-08 03:51:40 +00:00
parent ef06694779
commit 110351d3de
4 changed files with 56 additions and 14 deletions

View File

@@ -44,6 +44,14 @@
#include <string>
#ifdef HAVE_CONFIG_H
#include <cvconfig.h>
#endif
#ifdef HAVE_TBB
#include "tbb/task_scheduler_init.h"
#endif
using namespace cv;
const int num_detections = 3;
@@ -77,7 +85,12 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
{
string img_path = string(ts->get_data_path()) + "latentsvmdetector/cat.jpg";
string model_path = string(ts->get_data_path()) + "latentsvmdetector/cat.xml";
int numThreads = -1;
#ifdef HAVE_TBB
numThreads = 2;
tbb::task_scheduler_init init(tbb::task_scheduler_init::deferred);
init.initialize(numThreads);
#endif
IplImage* image = cvLoadImage(img_path.c_str());
if (!image)
{
@@ -95,8 +108,7 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
CvMemStorage* storage = cvCreateMemStorage(0);
CvSeq* detections = 0;
detections = cvLatentSvmDetectObjects(image, detector, storage);
detections = cvLatentSvmDetectObjects(image, detector, storage, 0.5f, numThreads);
if (detections->total != num_detections)
{
ts->set_failed_test_info( cvtest::TS::FAIL_MISMATCH );
@@ -116,7 +128,9 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
}
}
}
#ifdef HAVE_TBB
init.terminate();
#endif
cvReleaseMemStorage( &storage );
cvReleaseLatentSvmDetector( &detector );
cvReleaseImage( &image );