Goal
=====
-In this tutorial you will learn how to:
+In this tutorial you will learn:
.. container:: enumeratevisibleitemswithsquare
+ * What features are and why they are important
* Use the function :corner_harris:`cornerHarris <>` to detect corners using the Harris-Stephens method.
Theory
======
+What is a feature?
+-------------------
+
+.. container:: enumeratevisibleitemswithsquare
+
+ * In computer vision, usually we need to find matching points between different frames of an environment. Why? If we know how two images relate to each other, we can use *both* images to extract information of them.
+
+ * When we say **matching points** we are referring, in a general sense, to *characteristics* in the scene that we can recognize easily. We call these characteristics **features**.
+
+ * **So, what characteristics should a feature have?**
+
+ * It must be *uniquely recognizable*
+
+
+Types of Image Features
+------------------------
+
+To mention a few:
+
+.. container:: enumeratevisibleitemswithsquare
+
+ * Edges
+ * Corner (also known as interest points)
+ * Blobs (also known as regions of interest )
+
+In this tutorial we will study the *corner* features, specifically.
+
+Why is a corner so special?
+----------------------------
+
Code
====
Code
======
-This tutorial code's is shown lines below. You can also download it from `here <https://code.ros.org/svn/opencv/trunk/opencv/samples/cpp/tutorial_code/Image_Processing/Morphology_1.cpp>`_
+This tutorial code's is shown lines below. You can also download it from `here <https://code.ros.org/svn/opencv/trunk/opencv/samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp>`_
.. code-block:: cpp
#. Most of the stuff shown is known by you (if you have any doubt, please refer to the tutorials in previous sections). Let's check the general structure of the program:
- * Load an image (can be RGB or grayscale)
+ .. container:: enumeratevisibleitemswithsquare
- * Create two windows (one for dilation output, the other for erosion)
+ * Load an image (can be RGB or grayscale)
+ * Create two windows (one for dilation output, the other for erosion)
+ * Create a set of 02 Trackbars for each operation:
- * Create a set of 02 Trackbars for each operation:
+ * The first trackbar "Element" returns either **erosion_elem** or **dilation_elem**
+ * The second trackbar "Kernel size" return **erosion_size** or **dilation_size** for the corresponding operation.
- * The first trackbar "Element" returns either **erosion_elem** or **dilation_elem**
- * The second trackbar "Kernel size" return **erosion_size** or **dilation_size** for the corresponding operation.
-
- * Every time we move any slider, the user's function **Erosion** or **Dilation** will be called and it will update the output image based on the current trackbar values.
+ * Every time we move any slider, the user's function **Erosion** or **Dilation** will be called and it will update the output image based on the current trackbar values.
Let's analyze these two functions:
Size( 2*erosion_size + 1, 2*erosion_size+1 ),
Point( erosion_size, erosion_size ) );
- We can choose any of three shapes for our kernel:
+ We can choose any of three shapes for our kernel:
+
+ .. container:: enumeratevisibleitemswithsquare
- * Rectangular box: MORPH_RECT
- * Cross: MORPH_CROSS
- * Ellipse: MORPH_ELLIPSE
+ + Rectangular box: MORPH_RECT
+ + Cross: MORPH_CROSS
+ + Ellipse: MORPH_ELLIPSE
- Then, we just have to specify the size of our kernel and the *anchor point*. If not specified, it is assumed to be in the center.
+ Then, we just have to specify the size of our kernel and the *anchor point*. If not specified, it is assumed to be in the center.
* That is all. We are ready to perform the erosion of our image.
.. image:: images/Morphology_1_Tutorial_Cover.jpg
:alt: Dilation and Erosion application
- :align: center
\ No newline at end of file
+ :align: center
In this tutorial you will learn how to:
-a. Use the OpenCV function :canny:`Canny <>` to implement the Canny Edge Detector.
+.. container:: enumeratevisibleitemswithsquare
+
+ * Use the OpenCV function :canny:`Canny <>` to implement the Canny Edge Detector.
Theory
=======
Result
=======
-#. After compiling the code above, we can run it giving as argument the path to an image. For example, using as an input the following image:
+* After compiling the code above, we can run it giving as argument the path to an image. For example, using as an input the following image:
.. image:: images/Canny_Detector_Tutorial_Original_Image.jpg
:alt: Original test image
:width: 200pt
:align: center
- and moving the slider, trying different threshold, we obtain the following result:
+* Moving the slider, trying different threshold, we obtain the following result:
.. image:: images/Canny_Detector_Tutorial_Result.jpg
:alt: Result after running Canny
:width: 200pt
:align: center
- Notice how the image is superposed to the black background on the edge regions.
+* Notice how the image is superposed to the black background on the edge regions.
In this tutorial you will learn how to:
-#. Use the OpenCV function :copy_make_border:`copyMakeBorder <>` to set the borders (extra padding to your image).
+.. container:: enumeratevisibleitemswithsquare
+
+ * Use the OpenCV function :copy_make_border:`copyMakeBorder <>` to set the borders (extra padding to your image).
Theory
-============
+========
.. note::
The explanation below belongs to the book **Learning OpenCV** by Bradski and Kaehler.
#. After compiling the code above, you can execute it giving as argument the path of an image. The result should be:
- * By default, it begins with the border set to BORDER_CONSTANT. Hence, a succession of random colored borders will be shown.
- * If you press 'r', the border will become a replica of the edge pixels.
- * If you press 'c', the random colored borders will appear again
- * If you press 'ESC' the program will exit.
+ .. container:: enumeratevisibleitemswithsquare
+
+ * By default, it begins with the border set to BORDER_CONSTANT. Hence, a succession of random colored borders will be shown.
+ * If you press 'r', the border will become a replica of the edge pixels.
+ * If you press 'c', the random colored borders will appear again
+ * If you press 'ESC' the program will exit.
Below some screenshot showing how the border changes color and how the *BORDER_REPLICATE* option looks:
In this tutorial you will learn how to:
-* Use the OpenCV function :filter2d:`filter2D <>` to create your own linear filters.
+.. container:: enumeratevisibleitemswithsquare
+
+ * Use the OpenCV function :filter2d:`filter2D <>` to create your own linear filters.
Theory
-============
+=======
.. note::
The explanation below belongs to the book **Learning OpenCV** by Bradski and Kaehler.
In this tutorial you will learn how to:
-a. Use the OpenCV function :laplacian:`Laplacian <>` to implement a discrete analog of the *Laplacian operator*.
+.. container:: enumeratevisibleitemswithsquare
+
+ * Use the OpenCV function :laplacian:`Laplacian <>` to implement a discrete analog of the *Laplacian operator*.
Theory
In this tutorial you will learn how to:
-#. Use the OpenCV function :sobel:`Sobel <>` to calculate the derivatives from an image.
-#. Use the OpenCV function :scharr:`Scharr <>` to calculate a more accurate derivative for a kernel of size :math:`3 \cdot 3`
+.. container:: enumeratevisibleitemswithsquare
+
+ * Use the OpenCV function :sobel:`Sobel <>` to calculate the derivatives from an image.
+ * Use the OpenCV function :scharr:`Scharr <>` to calculate a more accurate derivative for a kernel of size :math:`3 \cdot 3`
Theory
========
In this tutorial you will learn how to:
-* Use the OpenCV function :morphology_ex:`morphologyEx <>` to apply Morphological Transformation such as:
+.. container:: enumeratevisibleitemswithsquare
+
+ * Use the OpenCV function :morphology_ex:`morphologyEx <>` to apply Morphological Transformation such as:
- * Opening
- * Closing
- * Morphological Gradient
- * Top Hat
- * Black Hat
+ + Opening
+ + Closing
+ + Morphological Gradient
+ + Top Hat
+ + Black Hat
-Cool Theory
-============
+Theory
+=======
.. note::
The explanation below belongs to the book **Learning OpenCV** by Bradski and Kaehler.
In the previous tutorial we covered two basic Morphology operations:
-* Erosion
+.. container:: enumeratevisibleitemswithsquare
-* Dilation.
+ * Erosion
+ * Dilation.
Based on these two we can effectuate more sophisticated transformations to our images. Here we discuss briefly 05 operations offered by OpenCV:
* **dst**: Output image
* **operation**: The kind of morphology transformation to be performed. Note that we have 5 alternatives:
- * *Opening*: MORPH_OPEN : 2
- * *Closing*: MORPH_CLOSE: 3
- * *Gradient*: MORPH_GRADIENT: 4
- * *Top Hat*: MORPH_TOPHAT: 5
- * *Black Hat*: MORPH_BLACKHAT: 6
+ + *Opening*: MORPH_OPEN : 2
+ + *Closing*: MORPH_CLOSE: 3
+ + *Gradient*: MORPH_GRADIENT: 4
+ + *Top Hat*: MORPH_TOPHAT: 5
+ + *Black Hat*: MORPH_BLACKHAT: 6
As you can see the values range from <2-6>, that is why we add (+2) to the values entered by the Trackbar:
In this tutorial you will learn how to:
-* Use the OpenCV functions :pyr_up:`pyrUp <>` and :pyr_down:`pyrDown <>` to downsample or upsample a given image.
+.. container:: enumeratevisibleitemswithsquare
+
+ * Use the OpenCV functions :pyr_up:`pyrUp <>` and :pyr_down:`pyrDown <>` to downsample or upsample a given image.
Theory
=======
.. note::
The explanation below belongs to the book **Learning OpenCV** by Bradski and Kaehler.
-* Usually we need to convert an image to a size different than its original. For this, there are two possible options:
+.. container:: enumeratevisibleitemswithsquare
+
+ * Usually we need to convert an image to a size different than its original. For this, there are two possible options:
- * *Upsize* the image (zoom in) or
- * *Downsize* it (zoom out).
+ #. *Upsize* the image (zoom in) or
+ #. *Downsize* it (zoom out).
+
+ * Although there is a *geometric transformation* function in OpenCV that -literally- resize an image (:resize:`resize <>`, which we will show in a future tutorial), in this section we analyze first the use of **Image Pyramids**, which are widely applied in a huge range of vision applications.
-* Although there is a *geometric transformation* function in OpenCV that -literally- resize an image (:resize:`resize <>`, which we will show in a future tutorial), in this section we analyze first the use of **Image Pyramids**, which are widely applied in a huge range of vision applications.
Image Pyramid
--------------
-* An image pyramid is a collection of images - all arising from a single original image - that are successively downsampled until some desired stopping point is reached.
+.. container:: enumeratevisibleitemswithsquare
+
+ * An image pyramid is a collection of images - all arising from a single original image - that are successively downsampled until some desired stopping point is reached.
-* There are two common kinds of image pyramids:
+ * There are two common kinds of image pyramids:
- * **Gaussian pyramid:** Used to downsample images
+ * **Gaussian pyramid:** Used to downsample images
- * **Laplacian pyramid:** Used to reconstruct an upsampled image from an image lower in the pyramid (with less resolution)
+ * **Laplacian pyramid:** Used to reconstruct an upsampled image from an image lower in the pyramid (with less resolution)
-* In this tutorial we'll use the *Gaussian pyramid*.
+ * In this tutorial we'll use the *Gaussian pyramid*.
Gaussian Pyramid
^^^^^^^^^^^^^^^^^
In this tutorial you will learn how to:
-* Perform basic thresholding operations using OpenCV function :threshold:`threshold <>`
+.. container:: enumeratevisibleitemswithsquare
+
+ * Perform basic thresholding operations using OpenCV function :threshold:`threshold <>`
Cool Theory
.. image:: images/Threshold_Tutorial_Result_Zero.jpg
:alt: Threshold Result Zero
- :align: center
\ No newline at end of file
+ :align: center