2011-09-07 21:52:52 +02:00
|
|
|
#include "perf_precomp.hpp"
|
2013-03-13 13:22:44 +01:00
|
|
|
#include <opencv2/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,
|
2012-10-02 21:07:46 +02:00
|
|
|
testing::Combine(testing::Values( std::string("cv/shared/lena.png"),
|
|
|
|
std::string("cv/shared/1_itseez-0000289.png"),
|
|
|
|
std::string("cv/shared/1_itseez-0000492.png"),
|
2012-12-20 09:25:59 +01:00
|
|
|
std::string("cv/shared/1_itseez-0000573.png")),
|
2011-12-29 17:46:16 +01:00
|
|
|
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
|
|
|
|
2012-06-22 17:00:36 +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";
|
|
|
|
|
2012-10-09 13:28:10 +02:00
|
|
|
vector<Rect> faces;
|
2011-09-07 21:52:52 +02:00
|
|
|
|
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
|
|
|
{
|
2012-10-09 13:28:10 +02:00
|
|
|
faces.clear();
|
2011-09-08 11:29:27 +02:00
|
|
|
|
|
|
|
startTimer();
|
2012-10-09 13:28:10 +02:00
|
|
|
cc.detectMultiScale(img, faces, 1.1, 3, 0, minSize);
|
2011-09-08 11:29:27 +02:00
|
|
|
stopTimer();
|
2011-09-07 21:52:52 +02:00
|
|
|
}
|
2012-10-09 13:28:10 +02:00
|
|
|
|
|
|
|
std::sort(faces.begin(), faces.end(), comparators::RectLess());
|
2012-11-01 13:29:30 +01:00
|
|
|
SANITY_CHECK(faces, 3.001 * faces.size());
|
2013-08-27 12:23:26 +02:00
|
|
|
}
|