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
2d88f20c
Commit
2d88f20c
authored
Jun 04, 2013
by
Vadim Pisarevsky
Committed by
OpenCV Buildbot
Jun 04, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #935 from pengx17:2.4_filter2d_fix
parents
0cb16448
a7a94de7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
11 deletions
+18
-11
ocl.hpp
modules/ocl/include/opencv2/ocl/ocl.hpp
+2
-0
filtering.cpp
modules/ocl/src/filtering.cpp
+7
-3
gfft.cpp
modules/ocl/src/gfft.cpp
+2
-1
filtering_laplacian.cl
modules/ocl/src/opencl/filtering_laplacian.cl
+6
-6
test_optflow.cpp
modules/ocl/test/test_optflow.cpp
+1
-1
No files found.
modules/ocl/include/opencv2/ocl/ocl.hpp
View file @
2d88f20c
...
...
@@ -689,6 +689,8 @@ namespace cv
}
//! applies non-separable 2D linear filter to the image
// Note, at the moment this function only works when anchor point is in the kernel center
// and kernel size supported is either 3x3 or 5x5; otherwise the function will fail to output valid result
CV_EXPORTS
void
filter2D
(
const
oclMat
&
src
,
oclMat
&
dst
,
int
ddepth
,
const
Mat
&
kernel
,
Point
anchor
=
Point
(
-
1
,
-
1
),
int
borderType
=
BORDER_DEFAULT
);
...
...
modules/ocl/src/filtering.cpp
View file @
2d88f20c
...
...
@@ -645,7 +645,11 @@ static void GPUFilter2D(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
src
.
wholecols
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
src
.
wholerows
));
openCLExecuteKernel
(
clCxt
,
&
filtering_laplacian
,
kernelName
,
globalThreads
,
localThreads
,
args
,
cn
,
depth
);
const
int
buffer_size
=
100
;
char
opt_buffer
[
buffer_size
]
=
""
;
sprintf
(
opt_buffer
,
"-DANCHOR=%d -DANX=%d -DANY=%d"
,
ksize
.
width
,
anchor
.
x
,
anchor
.
y
);
openCLExecuteKernel
(
clCxt
,
&
filtering_laplacian
,
kernelName
,
globalThreads
,
localThreads
,
args
,
cn
,
depth
,
opt_buffer
);
}
Ptr
<
BaseFilter_GPU
>
cv
::
ocl
::
getLinearFilter_GPU
(
int
srcType
,
int
dstType
,
const
Mat
&
kernel
,
const
Size
&
ksize
,
Point
anchor
,
int
borderType
)
...
...
@@ -656,7 +660,7 @@ Ptr<BaseFilter_GPU> cv::ocl::getLinearFilter_GPU(int srcType, int dstType, const
oclMat
gpu_krnl
;
int
nDivisor
;
normalizeKernel
(
kernel
,
gpu_krnl
,
CV_32S
,
&
nDivisor
,
tru
e
);
normalizeKernel
(
kernel
,
gpu_krnl
,
CV_32S
,
&
nDivisor
,
fals
e
);
normalizeAnchor
(
anchor
,
ksize
);
return
Ptr
<
BaseFilter_GPU
>
(
new
LinearFilter_GPU
(
ksize
,
anchor
,
gpu_krnl
,
GPUFilter2D_callers
[
CV_MAT_CN
(
srcType
)],
...
...
@@ -1172,7 +1176,7 @@ void linearRowFilter_gpu(const oclMat &src, const oclMat &dst, oclMat mat_kernel
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
ridusy
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
mat_kernel
.
data
));
openCLExecuteKernel
2
(
clCxt
,
&
filter_sep_row
,
kernelName
,
globalThreads
,
localThreads
,
args
,
channels
,
src
.
depth
(),
compile_option
,
CLFLUSH
);
openCLExecuteKernel
(
clCxt
,
&
filter_sep_row
,
kernelName
,
globalThreads
,
localThreads
,
args
,
channels
,
src
.
depth
(),
compile_option
);
}
Ptr
<
BaseRowFilter_GPU
>
cv
::
ocl
::
getLinearRowFilter_GPU
(
int
srcType
,
int
/*bufType*/
,
const
Mat
&
rowKernel
,
int
anchor
,
int
bordertype
)
...
...
modules/ocl/src/gfft.cpp
View file @
2d88f20c
...
...
@@ -257,7 +257,8 @@ void cv::ocl::GoodFeaturesToTrackDetector_OCL::operator ()(const oclMat& image,
if
(
minDistance
<
1
)
{
corners
=
tmpCorners_
(
Rect
(
0
,
0
,
maxCorners
>
0
?
std
::
min
(
maxCorners
,
total
)
:
total
,
1
));
Rect
roi_range
(
0
,
0
,
maxCorners
>
0
?
std
::
min
(
maxCorners
,
total
)
:
total
,
1
);
tmpCorners_
(
roi_range
).
copyTo
(
corners
);
}
else
{
...
...
modules/ocl/src/opencl/filtering_laplacian.cl
View file @
2d88f20c
...
...
@@ -82,9 +82,9 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////Macro
for
define
elements
number
per
thread/////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
#
define
ANCHOR
3
#
define
ANX
1
#
define
ANY
1
//
#define
ANCHOR
3
//
#define
ANX
1
//
#define
ANY
1
#
define
ROWS_PER_GROUP
4
#
define
ROWS_PER_GROUP_BITS
2
...
...
@@ -185,7 +185,7 @@ __kernel void filter2D_C1_D0(__global uchar *src, int src_step, int src_offset_x
for
(
int
i
=
0
; i < ANCHOR; i++)
{
#
pragma
unroll
3
#
pragma
unroll
for
(
int
j
=
0
; j < ANCHOR; j++)
{
if
(
dst_rows_index
<
dst_rows_end
)
...
...
@@ -295,7 +295,7 @@ __kernel void filter2D_C1_D5(__global float *src, int src_step, int src_offset_x
for
(
int
i
=
0
; i < ANCHOR; i++)
{
#
pragma
unroll
3
#
pragma
unroll
for
(
int
j
=
0
; j < ANCHOR; j++)
{
if
(
dst_rows_index
<
dst_rows_end
)
...
...
@@ -410,7 +410,7 @@ __kernel void filter2D_C4_D0(__global uchar4 *src, int src_step, int src_offset_
for
(
int
i
=
0
; i < ANCHOR; i++)
{
#
pragma
unroll
3
#
pragma
unroll
for
(
int
j
=
0
; j < ANCHOR; j++)
{
if
(
dst_rows_index
<
dst_rows_end
)
...
...
modules/ocl/test/test_optflow.cpp
View file @
2d88f20c
...
...
@@ -121,7 +121,7 @@ TEST_P(GoodFeaturesToTrack, EmptyCorners)
cv
::
ocl
::
GoodFeaturesToTrackDetector_OCL
detector
(
maxCorners
,
qualityLevel
,
minDistance
);
cv
::
ocl
::
oclMat
src
(
100
,
1
00
,
CV_8UC1
,
cv
::
Scalar
::
all
(
0
));
cv
::
ocl
::
oclMat
src
(
100
,
1
28
,
CV_8UC1
,
cv
::
Scalar
::
all
(
0
));
cv
::
ocl
::
oclMat
corners
(
1
,
maxCorners
,
CV_32FC2
);
detector
(
src
,
corners
);
...
...
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