refactored gpu::matchTemplate (converted it into Algorithm)
This commit is contained in:
@@ -17,24 +17,16 @@
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
static void InitMatchTemplate()
|
||||
{
|
||||
Mat src; gen(src, 500, 500, CV_32F, 0, 1);
|
||||
Mat templ; gen(templ, 500, 500, CV_32F, 0, 1);
|
||||
gpu::GpuMat d_src(src), d_templ(templ), d_dst;
|
||||
gpu::matchTemplate(d_src, d_templ, d_dst, TM_CCORR);
|
||||
}
|
||||
|
||||
|
||||
TEST(matchTemplate)
|
||||
{
|
||||
InitMatchTemplate();
|
||||
|
||||
Mat src, templ, dst;
|
||||
gen(src, 3000, 3000, CV_32F, 0, 1);
|
||||
|
||||
gpu::GpuMat d_src(src), d_templ, d_dst;
|
||||
|
||||
Ptr<gpu::TemplateMatching> alg = gpu::createTemplateMatching(src.type(), TM_CCORR);
|
||||
|
||||
for (int templ_size = 5; templ_size < 200; templ_size *= 5)
|
||||
{
|
||||
SUBTEST << src.cols << 'x' << src.rows << ", 32FC1" << ", templ " << templ_size << 'x' << templ_size << ", CCORR";
|
||||
@@ -47,10 +39,10 @@ TEST(matchTemplate)
|
||||
CPU_OFF;
|
||||
|
||||
d_templ.upload(templ);
|
||||
gpu::matchTemplate(d_src, d_templ, d_dst, TM_CCORR);
|
||||
alg->match(d_src, d_templ, d_dst);
|
||||
|
||||
GPU_ON;
|
||||
gpu::matchTemplate(d_src, d_templ, d_dst, TM_CCORR);
|
||||
alg->match(d_src, d_templ, d_dst);
|
||||
GPU_OFF;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user