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
a3592cd0
Commit
a3592cd0
authored
Jun 26, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added ocl_** function
parent
ad9272e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
morph.cpp
modules/imgproc/src/morph.cpp
+58
-0
No files found.
modules/imgproc/src/morph.cpp
View file @
a3592cd0
...
...
@@ -1541,10 +1541,68 @@ void cv::dilate( InputArray src, OutputArray dst, InputArray kernel,
morphOp
(
MORPH_DILATE
,
src
,
dst
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
}
#ifdef HAVE_OPENCL
static
void
ocl_morphologyEx
(
InputArray
_src
,
OutputArray
_dst
,
int
op
,
InputArray
kernel
,
Point
anchor
,
int
iterations
,
int
borderType
,
const
Scalar
&
borderValue
)
{
int
type
=
_src
.
type
(),
cn
=
CV_MAT_CN
(
type
);
Size
ksize
=
kernel
.
size
();
_dst
.
create
(
_src
.
size
(),
type
);
UMat
temp
;
switch
(
op
)
{
case
MORPH_ERODE
:
erode
(
_src
,
_dst
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
break
;
case
MORPH_DILATE
:
dilate
(
_src
,
_dst
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
break
;
case
MORPH_OPEN
:
erode
(
_src
,
temp
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
dilate
(
temp
,
_dst
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
break
;
case
CV_MOP_CLOSE
:
dilate
(
_src
,
temp
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
erode
(
temp
,
_dst
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
break
;
case
CV_MOP_GRADIENT
:
// ??
erode
(
_src
,
temp
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
dilate
(
_src
,
_dst
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
subtract
(
_dst
,
temp
,
_dst
);
break
;
case
CV_MOP_TOPHAT
:
// ??
erode
(
_src
,
temp
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
dilate
(
temp
,
_dst
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
subtract
(
_src
,
_dst
,
_dst
);
break
;
case
CV_MOP_BLACKHAT
:
// ??
dilate
(
_src
,
temp
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
erode
(
temp
,
_dst
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
subtract
(
_dst
,
_src
,
_dst
);
break
;
default
:
CV_Error
(
CV_StsBadArg
,
"unknown morphological operation"
);
}
}
#endif
void
cv
::
morphologyEx
(
InputArray
_src
,
OutputArray
_dst
,
int
op
,
InputArray
kernel
,
Point
anchor
,
int
iterations
,
int
borderType
,
const
Scalar
&
borderValue
)
{
CV_OCL_RUN
(
_dst
.
isUMat
()
&&
_src
.
dims
()
<=
2
&&
cn
<=
4
&&
anchor
.
x
==
ksize
.
width
>>
1
&&
anchor
.
y
==
ksize
.
height
>>
1
&&
borderType
==
cv
::
BORDER_CONSTANT
&&
borderValue
==
morphologyDefaultBorderValue
(),
ocl_morphologyEx
(
_src
,
_dst
,
op
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
))
Mat
src
=
_src
.
getMat
(),
temp
;
_dst
.
create
(
src
.
size
(),
src
.
type
());
Mat
dst
=
_dst
.
getMat
();
...
...
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