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
a4225942
Commit
a4225942
authored
Jun 04, 2014
by
Alexander Alekhin
Committed by
OpenCV Buildbot
Jun 04, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2794 from mletavin:pullreq/140516-median
parents
47f1026c
e224e72b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
medianFilter.cl
modules/imgproc/src/opencl/medianFilter.cl
+0
-0
smooth.cpp
modules/imgproc/src/smooth.cpp
+30
-4
No files found.
modules/imgproc/src/opencl/medianFilter.cl
View file @
a4225942
This diff is collapsed.
Click to expand it.
modules/imgproc/src/smooth.cpp
View file @
a4225942
...
...
@@ -2014,14 +2014,30 @@ medianBlur_SortNet( const Mat& _src, Mat& _dst, int m )
static
bool
ocl_medianFilter
(
InputArray
_src
,
OutputArray
_dst
,
int
m
)
{
size_t
localsize
[
2
]
=
{
16
,
16
};
size_t
globalsize
[
2
];
int
type
=
_src
.
type
(),
depth
=
CV_MAT_DEPTH
(
type
),
cn
=
CV_MAT_CN
(
type
);
if
(
!
((
depth
==
CV_8U
||
depth
==
CV_16U
||
depth
==
CV_16S
||
depth
==
CV_32F
)
&&
cn
<=
4
&&
(
m
==
3
||
m
==
5
))
)
return
false
;
ocl
::
Kernel
k
(
format
(
"medianFilter%d"
,
m
).
c_str
(),
ocl
::
imgproc
::
medianFilter_oclsrc
,
format
(
"-D T=%s -D T1=%s -D cn=%d"
,
ocl
::
typeToStr
(
type
),
ocl
::
typeToStr
(
depth
),
cn
));
Size
imgSize
=
_src
.
size
();
bool
useOptimized
=
(
1
==
cn
)
&&
(
size_t
)
imgSize
.
width
>=
localsize
[
0
]
*
8
&&
(
size_t
)
imgSize
.
height
>=
localsize
[
1
]
*
8
&&
imgSize
.
width
%
4
==
0
&&
imgSize
.
height
%
4
==
0
&&
(
ocl
::
Device
::
getDefault
().
isIntel
());
cv
::
String
kname
=
format
(
useOptimized
?
"medianFilter%d_u"
:
"medianFilter%d"
,
m
)
;
cv
::
String
kdefs
=
useOptimized
?
format
(
"-D T=%s -D T1=%s -D T4=%s%d -D cn=%d -D USE_4OPT"
,
ocl
::
typeToStr
(
type
),
ocl
::
typeToStr
(
depth
),
ocl
::
typeToStr
(
depth
),
cn
*
4
,
cn
)
:
format
(
"-D T=%s -D T1=%s -D cn=%d"
,
ocl
::
typeToStr
(
type
),
ocl
::
typeToStr
(
depth
),
cn
)
;
ocl
::
Kernel
k
(
kname
.
c_str
(),
ocl
::
imgproc
::
medianFilter_oclsrc
,
kdefs
.
c_str
()
);
if
(
k
.
empty
())
return
false
;
...
...
@@ -2031,7 +2047,17 @@ static bool ocl_medianFilter(InputArray _src, OutputArray _dst, int m)
k
.
args
(
ocl
::
KernelArg
::
ReadOnlyNoSize
(
src
),
ocl
::
KernelArg
::
WriteOnly
(
dst
));
size_t
globalsize
[
2
]
=
{
(
src
.
cols
+
18
)
/
16
*
16
,
(
src
.
rows
+
15
)
/
16
*
16
},
localsize
[
2
]
=
{
16
,
16
};
if
(
useOptimized
)
{
globalsize
[
0
]
=
DIVUP
(
src
.
cols
/
4
,
localsize
[
0
])
*
localsize
[
0
];
globalsize
[
1
]
=
DIVUP
(
src
.
rows
/
4
,
localsize
[
1
])
*
localsize
[
1
];
}
else
{
globalsize
[
0
]
=
(
src
.
cols
+
localsize
[
0
]
+
2
)
/
localsize
[
0
]
*
localsize
[
0
];
globalsize
[
1
]
=
(
src
.
rows
+
localsize
[
1
]
-
1
)
/
localsize
[
1
]
*
localsize
[
1
];
}
return
k
.
run
(
2
,
globalsize
,
localsize
,
false
);
}
...
...
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