2011-09-07 21:52:52 +02:00
|
|
|
#include "perf_precomp.hpp"
|
2011-09-28 23:14:20 +02:00
|
|
|
#include <opencv2/imgproc/imgproc.hpp>
|
2011-09-07 21:52:52 +02:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace cv;
|
|
|
|
using namespace perf;
|
2011-12-29 17:46:16 +01:00
|
|
|
using std::tr1::make_tuple;
|
|
|
|
using std::tr1::get;
|
2011-09-07 21:52:52 +02:00
|
|
|
|
2011-09-08 11:29:27 +02:00
|
|
|
typedef std::tr1::tuple<std::string, int> ImageName_MinSize_t;
|
2011-09-07 21:52:52 +02:00
|
|
|
typedef perf::TestBaseWithParam<ImageName_MinSize_t> ImageName_MinSize;
|
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
PERF_TEST_P(ImageName_MinSize, CascadeClassifierLBPFrontalFace,
|
|
|
|
testing::Combine(testing::Values( std::string("cv/shared/lena.jpg"),
|
|
|
|
std::string("cv/shared/1_itseez-0000247.jpg"),
|
|
|
|
std::string("cv/shared/1_itseez-0000289.jpg"),
|
|
|
|
std::string("cv/shared/1_itseez-0000492.jpg"),
|
|
|
|
std::string("cv/shared/1_itseez-0000573.jpg"),
|
|
|
|
std::string("cv/shared/1_itseez-0000803.jpg"),
|
|
|
|
std::string("cv/shared/1_itseez-0000892.jpg"),
|
|
|
|
std::string("cv/shared/1_itseez-0000984.jpg"),
|
|
|
|
std::string("cv/shared/1_itseez-0001238.jpg"),
|
|
|
|
std::string("cv/shared/1_itseez-0001438.jpg"),
|
|
|
|
std::string("cv/shared/1_itseez-0002524.jpg")),
|
|
|
|
testing::Values(24, 30, 40, 50, 60, 70, 80, 90)
|
|
|
|
)
|
|
|
|
)
|
2011-09-07 21:52:52 +02:00
|
|
|
{
|
2011-12-29 17:46:16 +01:00
|
|
|
const string filename = get<0>(GetParam());
|
|
|
|
int min_size = get<1>(GetParam());
|
2011-09-07 21:52:52 +02:00
|
|
|
Size minSize(min_size, min_size);
|
|
|
|
|
|
|
|
CascadeClassifier cc(getDataPath("cv/cascadeandhog/cascades/lbpcascade_frontalface.xml"));
|
2011-09-08 11:29:27 +02:00
|
|
|
if (cc.empty())
|
|
|
|
FAIL() << "Can't load cascade file";
|
2011-09-07 21:52:52 +02:00
|
|
|
|
2011-09-28 23:14:20 +02:00
|
|
|
Mat img=imread(getDataPath(filename), 0);
|
2011-09-08 11:29:27 +02:00
|
|
|
if (img.empty())
|
|
|
|
FAIL() << "Can't load source image";
|
|
|
|
|
2011-09-07 21:52:52 +02:00
|
|
|
vector<Rect> res;
|
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
equalizeHist(img, img);
|
|
|
|
declare.in(img);
|
2011-09-08 11:29:27 +02:00
|
|
|
|
|
|
|
while(next())
|
2011-09-07 21:52:52 +02:00
|
|
|
{
|
|
|
|
res.clear();
|
2011-09-08 11:29:27 +02:00
|
|
|
|
|
|
|
startTimer();
|
2011-09-07 21:52:52 +02:00
|
|
|
cc.detectMultiScale(img, res, 1.1, 3, 0, minSize);
|
2011-09-08 11:29:27 +02:00
|
|
|
stopTimer();
|
2011-09-07 21:52:52 +02:00
|
|
|
}
|
|
|
|
}
|