opencv/modules/gpu/perf_cpu/perf_objdetect.cpp

53 lines
1.3 KiB
C++
Raw Normal View History

2012-05-22 12:29:58 +02:00
#include "perf_cpu_precomp.hpp"
#ifdef HAVE_CUDA
2012-05-23 14:58:01 +02:00
///////////////////////////////////////////////////////////////
// HOG
GPU_PERF_TEST_1(HOG, cv::gpu::DeviceInfo)
{
2012-05-22 12:29:58 +02:00
cv::Mat img = readImage("gpu/hog/road.png", cv::IMREAD_GRAYSCALE);
2012-05-23 14:58:01 +02:00
ASSERT_FALSE(img.empty());
std::vector<cv::Rect> found_locations;
2012-05-22 12:29:58 +02:00
cv::HOGDescriptor hog;
hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector());
2012-05-23 14:58:01 +02:00
hog.detectMultiScale(img, found_locations);
TEST_CYCLE()
{
hog.detectMultiScale(img, found_locations);
}
}
INSTANTIATE_TEST_CASE_P(ObjDetect, HOG, ALL_DEVICES);
2012-05-23 14:58:01 +02:00
///////////////////////////////////////////////////////////////
// HaarClassifier
GPU_PERF_TEST_1(HaarClassifier, cv::gpu::DeviceInfo)
2012-05-23 14:58:01 +02:00
{
cv::Mat img = readImage("gpu/haarcascade/group_1_640x480_VGA.pgm", cv::IMREAD_GRAYSCALE);
2012-05-23 14:58:01 +02:00
ASSERT_FALSE(img.empty());
cv::CascadeClassifier cascade;
2012-05-23 14:58:01 +02:00
ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/perf/haarcascade_frontalface_alt.xml")));
std::vector<cv::Rect> rects;
2012-05-23 14:58:01 +02:00
cascade.detectMultiScale(img, rects);
TEST_CYCLE()
{
2012-05-23 14:58:01 +02:00
cascade.detectMultiScale(img, rects);
}
}
INSTANTIATE_TEST_CASE_P(ObjDetect, HaarClassifier, ALL_DEVICES);
#endif