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
3c31d6ad
Commit
3c31d6ad
authored
Nov 02, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5515 from LorenaGdL:hitAndMiss
parents
7323823b
7cff60f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+3
-1
morph.cpp
modules/imgproc/src/morph.cpp
+20
-0
No files found.
modules/imgproc/include/opencv2/imgproc.hpp
View file @
3c31d6ad
...
...
@@ -225,8 +225,10 @@ enum MorphTypes{
//!< \f[\texttt{dst} = \mathrm{morph\_grad} ( \texttt{src} , \texttt{element} )= \mathrm{dilate} ( \texttt{src} , \texttt{element} )- \mathrm{erode} ( \texttt{src} , \texttt{element} )\f]
MORPH_TOPHAT
=
5
,
//!< "top hat"
//!< \f[\texttt{dst} = \mathrm{tophat} ( \texttt{src} , \texttt{element} )= \texttt{src} - \mathrm{open} ( \texttt{src} , \texttt{element} )\f]
MORPH_BLACKHAT
=
6
//!< "black hat"
MORPH_BLACKHAT
=
6
,
//!< "black hat"
//!< \f[\texttt{dst} = \mathrm{blackhat} ( \texttt{src} , \texttt{element} )= \mathrm{close} ( \texttt{src} , \texttt{element} )- \texttt{src}\f]
MORPH_HITMISS
=
7
//!< "hit and miss"
//!< .- Only supported for CV_8UC1 binary images. Tutorial can be found in [this page](http://opencv-code.com/tutorials/hit-or-miss-transform-in-opencv/)
};
//! shape of the structuring element
...
...
modules/imgproc/src/morph.cpp
View file @
3c31d6ad
...
...
@@ -1872,6 +1872,8 @@ void cv::morphologyEx( InputArray _src, OutputArray _dst, int op,
_dst
.
create
(
src
.
size
(),
src
.
type
());
Mat
dst
=
_dst
.
getMat
();
Mat
k1
,
k2
,
e1
,
e2
;
//only for hit and miss op
switch
(
op
)
{
case
MORPH_ERODE
:
...
...
@@ -1907,6 +1909,24 @@ void cv::morphologyEx( InputArray _src, OutputArray _dst, int op,
erode
(
temp
,
temp
,
kernel
,
anchor
,
iterations
,
borderType
,
borderValue
);
dst
=
temp
-
src
;
break
;
case
MORPH_HITMISS
:
CV_Assert
(
src
.
type
()
==
CV_8UC1
);
k1
=
(
kernel
==
1
);
k2
=
(
kernel
==
-
1
);
if
(
countNonZero
(
k1
)
<=
0
)
e1
=
src
;
else
erode
(
src
,
e1
,
k1
,
anchor
,
iterations
,
borderType
,
borderValue
);
if
(
countNonZero
(
k2
)
<=
0
)
e2
=
src
;
else
{
Mat
src_complement
;
bitwise_not
(
src
,
src_complement
);
erode
(
src_complement
,
e2
,
k2
,
anchor
,
iterations
,
borderType
,
borderValue
);
}
dst
=
e1
&
e2
;
break
;
default
:
CV_Error
(
CV_StsBadArg
,
"unknown morphological operation"
);
}
...
...
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