Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
ac3f06bc
Commit
ac3f06bc
authored
Jan 24, 2014
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Jan 24, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2149 from ElenaGvozdeva:ocl_matchTemplate
parents
22c804d9
07a88d48
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
187 additions
and
0 deletions
+187
-0
perf_matchTemplate.cpp
modules/imgproc/perf/opencl/perf_matchTemplate.cpp
+58
-0
match_template.cl
modules/imgproc/src/opencl/match_template.cl
+0
-0
templmatch.cpp
modules/imgproc/src/templmatch.cpp
+0
-0
test_match_template.cpp
modules/imgproc/test/ocl/test_match_template.cpp
+129
-0
No files found.
modules/imgproc/perf/opencl/perf_matchTemplate.cpp
0 → 100644
View file @
ac3f06bc
#include "perf_precomp.hpp"
#include "opencv2/ts/ocl_perf.hpp"
#ifdef HAVE_OPENCL
namespace
cvtest
{
namespace
ocl
{
CV_ENUM
(
MethodType
,
TM_SQDIFF
,
TM_SQDIFF_NORMED
,
TM_CCORR
,
TM_CCORR_NORMED
,
TM_CCOEFF
,
TM_CCOEFF_NORMED
)
typedef
std
::
tr1
::
tuple
<
Size
,
Size
,
MethodType
>
ImgSize_TmplSize_Method_t
;
typedef
TestBaseWithParam
<
ImgSize_TmplSize_Method_t
>
ImgSize_TmplSize_Method
;
OCL_PERF_TEST_P
(
ImgSize_TmplSize_Method
,
MatchTemplate
,
::
testing
::
Combine
(
testing
::
Values
(
szSmall128
,
cv
::
Size
(
320
,
240
),
cv
::
Size
(
640
,
480
),
cv
::
Size
(
800
,
600
),
cv
::
Size
(
1024
,
768
),
cv
::
Size
(
1280
,
1024
)),
testing
::
Values
(
cv
::
Size
(
12
,
12
),
cv
::
Size
(
28
,
9
),
cv
::
Size
(
8
,
30
),
cv
::
Size
(
16
,
16
)),
MethodType
::
all
()
)
)
{
Size
imgSz
=
get
<
0
>
(
GetParam
());
Size
tmplSz
=
get
<
1
>
(
GetParam
());
int
method
=
get
<
2
>
(
GetParam
());
UMat
img
(
imgSz
,
CV_8UC1
);
UMat
tmpl
(
tmplSz
,
CV_8UC1
);
UMat
result
(
imgSz
-
tmplSz
+
Size
(
1
,
1
),
CV_32F
);
declare
.
in
(
img
,
WARMUP_RNG
)
.
in
(
tmpl
,
WARMUP_RNG
)
.
out
(
result
)
.
time
(
30
);
OCL_TEST_CYCLE
()
matchTemplate
(
img
,
tmpl
,
result
,
method
);
bool
isNormed
=
method
==
TM_CCORR_NORMED
||
method
==
TM_SQDIFF_NORMED
||
method
==
TM_CCOEFF_NORMED
;
double
eps
=
isNormed
?
3e-2
:
255
*
255
*
tmpl
.
total
()
*
1e-4
;
if
(
isNormed
)
SANITY_CHECK
(
result
,
eps
,
ERROR_RELATIVE
);
else
SANITY_CHECK
(
result
,
eps
);
}
}
}
#endif // HAVE_OPENCL
\ No newline at end of file
modules/imgproc/src/opencl/match_template.cl
0 → 100644
View file @
ac3f06bc
This diff is collapsed.
Click to expand it.
modules/imgproc/src/templmatch.cpp
View file @
ac3f06bc
This diff is collapsed.
Click to expand it.
modules/imgproc/test/ocl/test_match_template.cpp
0 → 100644
View file @
ac3f06bc
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors as is and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "test_precomp.hpp"
#include "opencv2/ts/ocl_test.hpp"
#include "iostream"
#include "fstream"
#ifdef HAVE_OPENCL
namespace
cvtest
{
namespace
ocl
{
/////////////////////////////////////////////matchTemplate//////////////////////////////////////////////////////////
PARAM_TEST_CASE
(
MatchTemplate
,
MatDepth
,
Channels
,
int
,
bool
)
{
int
type
;
int
depth
;
int
method
;
bool
use_roi
;
TEST_DECLARE_INPUT_PARAMETER
(
image
)
TEST_DECLARE_INPUT_PARAMETER
(
templ
)
TEST_DECLARE_OUTPUT_PARAMETER
(
result
)
virtual
void
SetUp
()
{
type
=
CV_MAKE_TYPE
(
GET_PARAM
(
0
),
GET_PARAM
(
1
));
depth
=
GET_PARAM
(
0
);
method
=
GET_PARAM
(
2
);
use_roi
=
GET_PARAM
(
3
);
}
virtual
void
generateTestData
()
{
Size
image_roiSize
=
randomSize
(
2
,
100
);
Size
templ_roiSize
=
Size
(
randomInt
(
1
,
image_roiSize
.
width
),
randomInt
(
1
,
image_roiSize
.
height
));
Size
result_roiSize
=
Size
(
image_roiSize
.
width
-
templ_roiSize
.
width
+
1
,
image_roiSize
.
height
-
templ_roiSize
.
height
+
1
);
const
double
upValue
=
256
;
Border
imageBorder
=
randomBorder
(
0
,
use_roi
?
MAX_VALUE
:
0
);
randomSubMat
(
image
,
image_roi
,
image_roiSize
,
imageBorder
,
type
,
-
upValue
,
upValue
);
Border
templBorder
=
randomBorder
(
0
,
use_roi
?
MAX_VALUE
:
0
);
randomSubMat
(
templ
,
templ_roi
,
templ_roiSize
,
templBorder
,
type
,
-
upValue
,
upValue
);
Border
resultBorder
=
randomBorder
(
0
,
use_roi
?
MAX_VALUE
:
0
);
randomSubMat
(
result
,
result_roi
,
result_roiSize
,
resultBorder
,
CV_32F
,
-
upValue
,
upValue
);
UMAT_UPLOAD_INPUT_PARAMETER
(
image
)
UMAT_UPLOAD_INPUT_PARAMETER
(
templ
)
UMAT_UPLOAD_OUTPUT_PARAMETER
(
result
)
}
void
Near
(
double
threshold
=
0.0
)
{
OCL_EXPECT_MATS_NEAR
(
result
,
threshold
);
}
};
OCL_TEST_P
(
MatchTemplate
,
Mat
)
{
for
(
int
j
=
0
;
j
<
test_loop_times
;
j
++
)
{
generateTestData
();
OCL_OFF
(
cv
::
matchTemplate
(
image_roi
,
templ_roi
,
result_roi
,
method
));
OCL_ON
(
cv
::
matchTemplate
(
uimage_roi
,
utempl_roi
,
uresult_roi
,
method
));
if
(
method
==
0
)
Near
(
10.0
f
);
else
Near
(
method
%
2
==
1
?
0.001
f
:
1.0
f
);
}
}
OCL_INSTANTIATE_TEST_CASE_P
(
ImageProc
,
MatchTemplate
,
Combine
(
Values
(
CV_8U
,
CV_32F
),
Values
(
1
,
2
,
4
),
Values
(
0
,
1
,
2
,
3
,
4
,
5
),
Bool
())
);
}
}
// namespace cvtest::ocl
#endif
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment