You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/tutorials/imgproc/hitOrMiss/hitOrMiss.markdown
+25-8Lines changed: 25 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,23 @@
1
1
Hit-or-Miss {#tutorial_hitOrMiss}
2
2
=================================
3
3
4
+
@prev_tutorial{tutorial_opening_closing_hats}
5
+
@next_tutorial{tutorial_morph_lines_detection}
6
+
4
7
Goal
5
8
----
6
9
7
10
In this tutorial you will learn how to find a given configuration or pattern in a binary image by using the Hit-or-Miss transform (also known as Hit-and-Miss transform).
8
11
This transform is also the basis of more advanced morphological operations such as thinning or pruning.
9
12
10
-
We will use the OpenCV function @ref cv::morphologyEx.
11
-
12
-
13
+
We will use the OpenCV function **morphologyEx()** .
13
14
14
15
Hit-or-Miss theory
15
16
-------------------
16
17
17
18
Morphological operators process images based on their shape. These operators apply one or more *structuring elements* to an input image to obtain the output image.
18
19
The two basic morphological operations are the *erosion* and the *dilation*. The combination of these two operations generate advanced morphological transformations such as *opening*, *closing*, or *top-hat* transform.
19
-
To know more about these and other basic morphological operations refer to previous tutorials @ref tutorial_erosion_dilatation "here" and @ref tutorial_opening_closing_hats "here".
20
+
To know more about these and other basic morphological operations refer to previous tutorials (@ref tutorial_erosion_dilatation "Eroding and Dilating") and (@ref tutorial_opening_closing_hats "More Morphology Transformations").
20
21
21
22
The Hit-or-Miss transformation is useful to find patterns in binary images. In particular, it finds those pixels whose neighbourhood matches the shape of a first structuring element \f$B_1\f$
22
23
while not matching the shape of a second structuring element \f$B_2\f$ at the same time. Mathematically, the operation applied to an image \f$A\f$ can be expressed as follows:
@@ -43,11 +44,27 @@ You can see that the pattern is found in just one location within the image.
43
44
Code
44
45
----
45
46
46
-
The code corresponding to the previous example is shown below. You can also download it from
0 commit comments