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
04628d77
Commit
04628d77
authored
Jun 17, 2014
by
Alexander Alekhin
Committed by
OpenCV Buildbot
Jun 17, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2849 from ElenaGvozdeva:ocl_matchTemplate_3cn
parents
f269a897
feeb386b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
8 deletions
+15
-8
perf_matchTemplate.cpp
modules/imgproc/perf/opencl/perf_matchTemplate.cpp
+1
-2
match_template.cl
modules/imgproc/src/opencl/match_template.cl
+0
-0
templmatch.cpp
modules/imgproc/src/templmatch.cpp
+13
-5
test_match_template.cpp
modules/imgproc/test/ocl/test_match_template.cpp
+1
-1
No files found.
modules/imgproc/perf/opencl/perf_matchTemplate.cpp
View file @
04628d77
...
...
@@ -86,4 +86,4 @@ OCL_PERF_TEST_P(CV_TM_CCORR_NORMEDFixture, matchTemplate,
}
}
#endif // HAVE_OPENCL
\ No newline at end of file
#endif // HAVE_OPENCL
modules/imgproc/src/opencl/match_template.cl
View file @
04628d77
This diff is collapsed.
Click to expand it.
modules/imgproc/src/templmatch.cpp
View file @
04628d77
...
...
@@ -69,8 +69,8 @@ static bool sumTemplate(InputArray _src, UMat & result)
char
cvt
[
40
];
ocl
::
Kernel
k
(
"calcSum"
,
ocl
::
imgproc
::
match_template_oclsrc
,
format
(
"-D CALC_SUM -D T=%s -D WT=%s -D cn=%d -D convertToWT=%s -D WGS=%d -D WGS2_ALIGNED=%d -D wdepth=%d"
,
ocl
::
typeToStr
(
type
),
ocl
::
typeToStr
(
wtype
),
cn
,
format
(
"-D CALC_SUM -D T=%s -D
T1=%s -D
WT=%s -D cn=%d -D convertToWT=%s -D WGS=%d -D WGS2_ALIGNED=%d -D wdepth=%d"
,
ocl
::
typeToStr
(
type
),
ocl
::
typeToStr
(
depth
),
ocl
::
typeToStr
(
wtype
),
cn
,
ocl
::
convertTypeStr
(
depth
,
wdepth
,
cn
,
cvt
),
(
int
)
wgs
,
wgs2_aligned
,
wdepth
));
if
(
k
.
empty
())
...
...
@@ -95,7 +95,7 @@ static bool matchTemplateNaive_CCORR(InputArray _image, InputArray _templ, Outpu
char
cvt
[
40
];
ocl
::
Kernel
k
(
"matchTemplate_Naive_CCORR"
,
ocl
::
imgproc
::
match_template_oclsrc
,
format
(
"-D CCORR -D T=%s -D
WT=%s -D convertToWT=%s -D cn=%d -D wdepth=%d"
,
ocl
::
typeToStr
(
type
),
ocl
::
typeToStr
(
wtype
),
format
(
"-D CCORR -D T=%s -D
T1=%s -D WT=%s -D convertToWT=%s -D cn=%d -D wdepth=%d"
,
ocl
::
typeToStr
(
type
),
ocl
::
typeToStr
(
depth
),
ocl
::
typeToStr
(
wtype
),
ocl
::
convertTypeStr
(
depth
,
wdepth
,
cn
,
cvt
),
cn
,
wdepth
));
if
(
k
.
empty
())
return
false
;
...
...
@@ -149,7 +149,7 @@ static bool matchTemplateNaive_SQDIFF(InputArray _image, InputArray _templ, Outp
char
cvt
[
40
];
ocl
::
Kernel
k
(
"matchTemplate_Naive_SQDIFF"
,
ocl
::
imgproc
::
match_template_oclsrc
,
format
(
"-D SQDIFF -D T=%s -D
WT=%s -D convertToWT=%s -D cn=%d -D wdepth=%d"
,
ocl
::
typeToStr
(
type
),
format
(
"-D SQDIFF -D T=%s -D
T1=%s -D WT=%s -D convertToWT=%s -D cn=%d -D wdepth=%d"
,
ocl
::
typeToStr
(
type
),
ocl
::
typeToStr
(
depth
),
ocl
::
typeToStr
(
wtype
),
ocl
::
convertTypeStr
(
depth
,
wdepth
,
cn
,
cvt
),
cn
,
wdepth
));
if
(
k
.
empty
())
return
false
;
...
...
@@ -191,6 +191,7 @@ static bool matchTemplate_SQDIFF_NORMED(InputArray _image, InputArray _templ, Ou
templ
.
rows
,
templ
.
cols
,
ocl
::
KernelArg
::
PtrReadOnly
(
templ_sqsum
));
size_t
globalsize
[
2
]
=
{
result
.
cols
,
result
.
rows
};
return
k
.
run
(
2
,
globalsize
,
NULL
,
false
);
}
...
...
@@ -235,6 +236,9 @@ static bool matchTemplate_CCOEFF(InputArray _image, InputArray _templ, OutputArr
if
(
cn
==
2
)
k
.
args
(
ocl
::
KernelArg
::
ReadOnlyNoSize
(
image_sums
),
ocl
::
KernelArg
::
ReadWrite
(
result
),
templ
.
rows
,
templ
.
cols
,
templ_sum
[
0
],
templ_sum
[
1
]);
else
if
(
cn
==
3
)
k
.
args
(
ocl
::
KernelArg
::
ReadOnlyNoSize
(
image_sums
),
ocl
::
KernelArg
::
ReadWrite
(
result
),
templ
.
rows
,
templ
.
cols
,
templ_sum
[
0
],
templ_sum
[
1
],
templ_sum
[
2
]);
else
k
.
args
(
ocl
::
KernelArg
::
ReadOnlyNoSize
(
image_sums
),
ocl
::
KernelArg
::
ReadWrite
(
result
),
templ
.
rows
,
templ
.
cols
,
templ_sum
[
0
],
templ_sum
[
1
],
templ_sum
[
2
],
templ_sum
[
3
]);
...
...
@@ -308,6 +312,10 @@ static bool matchTemplate_CCOEFF_NORMED(InputArray _image, InputArray _templ, Ou
k
.
args
(
ocl
::
KernelArg
::
ReadOnlyNoSize
(
image_sums
),
ocl
::
KernelArg
::
ReadOnlyNoSize
(
image_sqsums
),
ocl
::
KernelArg
::
ReadWrite
(
result
),
templ
.
rows
,
templ
.
cols
,
scale
,
templ_sum
[
0
],
templ_sum
[
1
],
templ_sqsum_sum
);
else
if
(
cn
==
3
)
k
.
args
(
ocl
::
KernelArg
::
ReadOnlyNoSize
(
image_sums
),
ocl
::
KernelArg
::
ReadOnlyNoSize
(
image_sqsums
),
ocl
::
KernelArg
::
ReadWrite
(
result
),
templ
.
rows
,
templ
.
cols
,
scale
,
templ_sum
[
0
],
templ_sum
[
1
],
templ_sum
[
2
],
templ_sqsum_sum
);
else
k
.
args
(
ocl
::
KernelArg
::
ReadOnlyNoSize
(
image_sums
),
ocl
::
KernelArg
::
ReadOnlyNoSize
(
image_sqsums
),
ocl
::
KernelArg
::
ReadWrite
(
result
),
templ
.
rows
,
templ
.
cols
,
scale
,
...
...
@@ -324,7 +332,7 @@ static bool ocl_matchTemplate( InputArray _img, InputArray _templ, OutputArray _
{
int
cn
=
_img
.
channels
();
if
(
cn
==
3
||
cn
>
4
)
if
(
cn
>
4
)
return
false
;
typedef
bool
(
*
Caller
)(
InputArray
_img
,
InputArray
_templ
,
OutputArray
_result
);
...
...
modules/imgproc/test/ocl/test_match_template.cpp
View file @
04628d77
...
...
@@ -118,7 +118,7 @@ OCL_TEST_P(MatchTemplate, Mat)
OCL_INSTANTIATE_TEST_CASE_P
(
ImageProc
,
MatchTemplate
,
Combine
(
Values
(
CV_8U
,
CV_32F
),
Values
(
1
,
2
,
4
),
Values
(
1
,
2
,
3
,
4
),
MatchTemplType
::
all
(),
Bool
())
);
...
...
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