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
53e77ed4
Commit
53e77ed4
authored
Feb 05, 2013
by
Andrey Kamaev
Committed by
OpenCV Buildbot
Feb 05, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #431 from snosov1:matchTemplate-tegra
parents
f608df96
c0e3d48e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
0 deletions
+86
-0
perf_matchTemplate.cpp
modules/imgproc/perf/perf_matchTemplate.cpp
+81
-0
templmatch.cpp
modules/imgproc/src/templmatch.cpp
+5
-0
No files found.
modules/imgproc/perf/perf_matchTemplate.cpp
0 → 100644
View file @
53e77ed4
#include "perf_precomp.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
CV_ENUM
(
MethodType
,
CV_TM_SQDIFF
,
CV_TM_SQDIFF_NORMED
,
CV_TM_CCORR
,
CV_TM_CCORR_NORMED
,
CV_TM_CCOEFF
,
CV_TM_CCOEFF_NORMED
)
typedef
std
::
tr1
::
tuple
<
Size
,
Size
,
MethodType
>
ImgSize_TmplSize_Method_t
;
typedef
perf
::
TestBaseWithParam
<
ImgSize_TmplSize_Method_t
>
ImgSize_TmplSize_Method
;
PERF_TEST_P
(
ImgSize_TmplSize_Method
,
matchTemplateSmall
,
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
)),
testing
::
ValuesIn
(
MethodType
::
all
())
)
)
{
Size
imgSz
=
get
<
0
>
(
GetParam
());
Size
tmplSz
=
get
<
1
>
(
GetParam
());
int
method
=
get
<
2
>
(
GetParam
());
Mat
img
(
imgSz
,
CV_8UC1
);
Mat
tmpl
(
tmplSz
,
CV_8UC1
);
Mat
result
(
imgSz
-
tmplSz
+
Size
(
1
,
1
),
CV_32F
);
declare
.
in
(
img
,
WARMUP_RNG
)
.
in
(
tmpl
,
WARMUP_RNG
)
.
out
(
result
);
TEST_CYCLE
()
matchTemplate
(
img
,
tmpl
,
result
,
method
);
bool
isNormed
=
method
==
CV_TM_CCORR_NORMED
||
method
==
CV_TM_SQDIFF_NORMED
||
method
==
CV_TM_CCOEFF_NORMED
;
double
eps
=
isNormed
?
1e-6
:
255
*
255
*
tmpl
.
total
()
*
1e-6
;
SANITY_CHECK
(
result
,
eps
);
}
PERF_TEST_P
(
ImgSize_TmplSize_Method
,
matchTemplateBig
,
testing
::
Combine
(
testing
::
Values
(
cv
::
Size
(
1280
,
1024
)),
testing
::
Values
(
cv
::
Size
(
1260
,
1000
),
cv
::
Size
(
1261
,
1013
)),
testing
::
ValuesIn
(
MethodType
::
all
())
)
)
{
Size
imgSz
=
get
<
0
>
(
GetParam
());
Size
tmplSz
=
get
<
1
>
(
GetParam
());
int
method
=
get
<
2
>
(
GetParam
());
Mat
img
(
imgSz
,
CV_8UC1
);
Mat
tmpl
(
tmplSz
,
CV_8UC1
);
Mat
result
(
imgSz
-
tmplSz
+
Size
(
1
,
1
),
CV_32F
);
declare
.
in
(
img
,
WARMUP_RNG
)
.
in
(
tmpl
,
WARMUP_RNG
)
.
out
(
result
);
TEST_CYCLE
()
matchTemplate
(
img
,
tmpl
,
result
,
method
);
bool
isNormed
=
method
==
CV_TM_CCORR_NORMED
||
method
==
CV_TM_SQDIFF_NORMED
||
method
==
CV_TM_CCOEFF_NORMED
;
double
eps
=
isNormed
?
1e-6
:
255
*
255
*
tmpl
.
total
()
*
1e-6
;
SANITY_CHECK
(
result
,
eps
);
}
modules/imgproc/src/templmatch.cpp
View file @
53e77ed4
...
...
@@ -252,6 +252,11 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
_result
.
create
(
corrSize
,
CV_32F
);
Mat
result
=
_result
.
getMat
();
#ifdef HAVE_TEGRA_OPTIMIZATION
if
(
tegra
::
matchTemplate
(
img
,
templ
,
result
,
method
))
return
;
#endif
int
cn
=
img
.
channels
();
crossCorr
(
img
,
templ
,
result
,
result
.
size
(),
result
.
type
(),
Point
(
0
,
0
),
0
,
0
);
...
...
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