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
084385cf
Commit
084385cf
authored
Mar 12, 2013
by
yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug in ocl::Erode/Dilate, simplify the host logic
parent
eaaba133
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
15 deletions
+9
-15
filtering.cpp
modules/ocl/src/filtering.cpp
+8
-10
filtering_morph.cl
modules/ocl/src/kernels/filtering_morph.cl
+1
-5
No files found.
modules/ocl/src/filtering.cpp
View file @
084385cf
...
...
@@ -195,7 +195,7 @@ public:
namespace
{
typedef
void
(
*
GPUMorfFilter_t
)(
const
oclMat
&
,
oclMat
&
,
oclMat
&
,
Size
&
,
const
Point
,
bool
rectKernel
,
bool
usrROI
);
typedef
void
(
*
GPUMorfFilter_t
)(
const
oclMat
&
,
oclMat
&
,
oclMat
&
,
Size
&
,
const
Point
,
bool
rectKernel
);
class
MorphFilter_GPU
:
public
BaseFilter_GPU
{
...
...
@@ -205,7 +205,7 @@ public:
virtual
void
operator
()(
const
oclMat
&
src
,
oclMat
&
dst
)
{
func
(
src
,
dst
,
kernel
,
ksize
,
anchor
,
rectKernel
,
false
)
;
func
(
src
,
dst
,
kernel
,
ksize
,
anchor
,
rectKernel
)
;
}
oclMat
kernel
;
...
...
@@ -220,7 +220,7 @@ public:
**Note that the kernel need to be further refined.
*/
static
void
GPUErode
(
const
oclMat
&
src
,
oclMat
&
dst
,
oclMat
&
mat_kernel
,
Size
&
ksize
,
const
Point
anchor
,
bool
rectKernel
,
bool
useROI
)
Size
&
ksize
,
const
Point
anchor
,
bool
rectKernel
)
{
//Normalize the result by default
//float alpha = ksize.height * ksize.width;
...
...
@@ -276,11 +276,10 @@ static void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
}
char
compile_option
[
128
];
sprintf
(
compile_option
,
"-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D ERODE %s %s
%s
"
,
sprintf
(
compile_option
,
"-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D ERODE %s %s"
,
anchor
.
x
,
anchor
.
y
,
(
int
)
localThreads
[
0
],
(
int
)
localThreads
[
1
],
rectKernel
?
"-D RECTKERNEL"
:
""
,
useROI
?
"-D USEROI"
:
""
,
s
);
rectKernel
?
"-D RECTKERNEL"
:
""
,
s
);
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
src
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
dst
.
data
));
...
...
@@ -300,7 +299,7 @@ static void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
//! data type supported: CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4
static
void
GPUDilate
(
const
oclMat
&
src
,
oclMat
&
dst
,
oclMat
&
mat_kernel
,
Size
&
ksize
,
const
Point
anchor
,
bool
rectKernel
,
bool
useROI
)
Size
&
ksize
,
const
Point
anchor
,
bool
rectKernel
)
{
//Normalize the result by default
//float alpha = ksize.height * ksize.width;
...
...
@@ -357,10 +356,9 @@ static void GPUDilate(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
}
char
compile_option
[
128
];
sprintf
(
compile_option
,
"-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D DILATE %s %s
%s
"
,
sprintf
(
compile_option
,
"-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D DILATE %s %s"
,
anchor
.
x
,
anchor
.
y
,
(
int
)
localThreads
[
0
],
(
int
)
localThreads
[
1
],
rectKernel
?
"-D RECTKERNEL"
:
""
,
useROI
?
"-D USEROI"
:
""
,
s
);
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
src
.
data
));
...
...
modules/ocl/src/kernels/filtering_morph.cl
View file @
084385cf
...
...
@@ -120,8 +120,7 @@ __kernel void morph_C1_D0(__global const uchar * restrict src,
int
gidy
=
get_global_id
(
1
)
;
int
out_addr
=
mad24
(
gidy,dst_step_in_pixel,gidx+dst_offset_in_pixel
)
;
#
ifdef
USEROI
if
(
gidx+3<cols
&&
gidy<rows
&&
(
dst_offset_in_pixel&3==0
))
if
(
gidx+3<cols
&&
gidy<rows
&&
(
dst_offset_in_pixel&3
)
==0
)
{
*
(
__global
uchar4*
)
&dst[out_addr]
=
res
;
}
...
...
@@ -150,9 +149,6 @@ __kernel void morph_C1_D0(__global const uchar * restrict src,
dst[out_addr]
=
res.x
;
}
}
#
else
*
(
__global
uchar4*
)
&dst[out_addr]
=
res
;
#
endif
}
#
else
__kernel
void
morph
(
__global
const
GENTYPE
*
restrict
src,
...
...
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