Added Equalized Histogram reST tutorial + corrected Smoothing tutorial (images reduce...
authorAna Huaman <no@email>
Wed, 6 Jul 2011 04:22:00 +0000 (04:22 +0000)
committerAna Huaman <no@email>
Wed, 6 Jul 2011 04:22:00 +0000 (04:22 +0000)
43 files changed:
doc/conf.py
doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter.rst
doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Cover.png [deleted file]
doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Result_Median_Filter.jpg [new file with mode: 0644]
doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Result_Median_Filter.png [deleted file]
doc/tutorials/imgproc/histograms/back_projection/back_projection.rst [new file with mode: 0644]
doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_BackProj.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_Histogram.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_Source_Image.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_BackProj.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_Mask.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_Source_Image.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_calculation/histogram_calculation.rst [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_calculation/images/Histogram_Calculation_Original_Image.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_calculation/images/Histogram_Calculation_Result.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.rst [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_0.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_1.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_2.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_equalization/histogram_equalization.rst [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Equalized_Histogram.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Equalized_Image.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Original_Histogram.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Original_Image.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_0.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_1.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_2.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_0.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_1.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_2.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_3.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_4.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_5.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Image_Result.jpg [new file with mode: 0644]
doc/tutorials/imgproc/histograms/template_matching/template_matching.rst [new file with mode: 0644]
doc/tutorials/imgproc/table_of_content_imgproc/images/Smoothing_Tutorial_Cover.jpg [new file with mode: 0644]
doc/tutorials/imgproc/table_of_content_imgproc/images/Smoothing_Tutorial_Cover.png [deleted file]
doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Back_Projection_Tutorial_Cover.jpg [new file with mode: 0644]
doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Calculation_Tutorial_Cover.jpg [new file with mode: 0644]
doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Comparison_Tutorial_Cover.jpg [new file with mode: 0644]
doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Equalization_Tutorial_Cover.jpg [new file with mode: 0644]
doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Template_Matching_Tutorial_Cover.jpg [new file with mode: 0644]
doc/tutorials/imgproc/table_of_content_imgproc/table_of_content_imgproc.rst

index 620a75f..1239581 100644 (file)
@@ -320,7 +320,8 @@ extlinks = {'cvt_color': ('http://opencv.willowgarage.com/documentation/cpp/imgp
            'remap' : ('http://opencv.willowgarage.com/documentation/cpp/imgproc_geometric_image_transformations.html?#remap%s', None),
            'warp_affine' : ('http://opencv.willowgarage.com/documentation/cpp/imgproc_geometric_image_transformations.html?#cv-warpaffine%s' , None),
            'get_rotation_matrix_2d' : ('http://opencv.willowgarage.com/documentation/cpp/imgproc_geometric_image_transformations.html?#cv-getrotationmatrix2d%s', None),
-            'get_affine_transform' : ('http://opencv.willowgarage.com/documentation/cpp/imgproc_geometric_image_transformations.html?#cv-getaffinetransform%s', None)
+            'get_affine_transform' : ('http://opencv.willowgarage.com/documentation/cpp/imgproc_geometric_image_transformations.html?#cv-getaffinetransform%s', None),
+            'equalize_hist' : ('http://opencv.willowgarage.com/documentation/cpp/imgproc_histograms.html?#equalizeHist%s', None)
            }
 
 
index 6fc7012..d5e8671 100644 (file)
@@ -6,77 +6,83 @@ Smoothing Images
 Goal
 =====
 
-In this tutorial you will learn how to:
+In this tutorial you will learn how to apply diverse linear filters to smooth images using OpenCV functions such as:
 
-* Apply diverse linear filters to smooth images using OpenCV functions such as:
+.. container:: enumeratevisibleitemswithsquare
 
-  * :blur:`blur <>`
-  * :gaussian_blur:`GaussianBlur <>`
-  * :median_blur:`medianBlur <>`
-  * :bilateral_filter:`bilateralFilter <>`
+   * :blur:`blur <>`
+   * :gaussian_blur:`GaussianBlur <>`
+   * :median_blur:`medianBlur <>`
+   * :bilateral_filter:`bilateralFilter <>`
 
-Cool Theory
-============
+Theory
+======
 
 .. note::
    The explanation below belongs to the book `Computer Vision: Algorithms and Applications <http://szeliski.org/Book/>`_  by Richard Szeliski and to *LearningOpenCV* 
 
-* *Smoothing*, also called *blurring*, is a simple and frequently used image processing operation. 
+.. container:: enumeratevisibleitemswithsquare
+
+   * *Smoothing*, also called *blurring*, is a simple and frequently used image processing operation. 
 
-* There are many reasons for smoothing. In this tutorial we will focus on smoothing in order to reduce noise (other uses will be seen in the following tutorials).
+   * There are many reasons for smoothing. In this tutorial we will focus on smoothing in order to reduce noise (other uses will be seen in the following tutorials).
 
-* To perform a smoothing operation we will apply a *filter* to our image. The most common type of filters are *linear*, in which an output pixel's value (i.e. :math:`g(i,j)`) is determined as a weighted sum of input pixel values (i.e. :math:`f(i+k,j+l)`) :
+   * To perform a smoothing operation we will apply a *filter* to our image. The most common type of filters are *linear*, in which an output pixel's value (i.e. :math:`g(i,j)`) is determined as a weighted sum of input pixel values (i.e. :math:`f(i+k,j+l)`) :
 
-  .. math::
-     g(i,j) = \sum_{k,l} f(i+k, j+l) h(k,l)
+     .. math::
+        g(i,j) = \sum_{k,l} f(i+k, j+l) h(k,l)
 
-  :math:`h(k,l)` is called the *kernel*, which is nothing more than the coefficients of the filter.
+     :math:`h(k,l)` is called the *kernel*, which is nothing more than the coefficients of the filter.
     
 
- It helps to visualize a *filter* as a window of coefficients sliding across the image.
    It helps to visualize a *filter* as a window of coefficients sliding across the image.
 
-* There are many kind of filters, here we will mention the most used:
+   * There are many kind of filters, here we will mention the most used:
 
 Normalized Box Filter
 -----------------------
 
-* This filter is the simplest of all! Each output pixel is the *mean* of its kernel neighbors ( all of them contribute with equal weights) 
+.. container:: enumeratevisibleitemswithsquare
 
-* Just in case, the kernel is below:
+   * This filter is the simplest of all! Each output pixel is the *mean* of its kernel neighbors ( all of them contribute with equal weights) 
 
-.. math::
+   * The kernel is below:
+
+     .. math::
    
-   K = \dfrac{1}{K_{width} \cdot K_{height}} \begin{bmatrix}
-    1 & 1 & 1 & ... & 1 \\
-    1 & 1 & 1 & ... & 1 \\
-    . & . & . & ... & 1 \\
-    . & . & . & ... & 1 \\
-    1 & 1 & 1 & ... & 1
-   \end{bmatrix} 
+        K = \dfrac{1}{K_{width} \cdot K_{height}} \begin{bmatrix}
+            1 & 1 & 1 & ... & 1 \\
+            1 & 1 & 1 & ... & 1 \\
+            . & . & . & ... & 1 \\
+            . & . & . & ... & 1 \\
+            1 & 1 & 1 & ... & 1
+           \end{bmatrix} 
 
 
 Gaussian Filter
 ---------------
-* Probably the most useful filter (although not the fastest). Gaussian filtering is done by convolving each point in the input array with a *Gaussian kernel* and then summing them all to produce the output array.
 
-* Just to make the picture clearer, remember how a 1D Gaussian kernel look like?
+.. container:: enumeratevisibleitemswithsquare
+
+   * Probably the most useful filter (although not the fastest). Gaussian filtering is done by convolving each point in the input array with a *Gaussian kernel* and then summing them all to produce the output array.
 
-  .. image:: images/Smoothing_Tutorial_theory_gaussian_0.jpg
-             :height: 200px
-             :align: center 
+   * Just to make the picture clearer, remember how a 1D Gaussian kernel look like?
 
-  Assuming that an image is 1D, you can notice that the pixel located in the middle would have the biggest weight. The weight of its neighbors decreases as the spatial distance between them and the center pixel increases. 
+     .. image:: images/Smoothing_Tutorial_theory_gaussian_0.jpg
+              :height: 100pt
+              :align: center 
+
+     Assuming that an image is 1D, you can notice that the pixel located in the middle would have the biggest weight. The weight of its neighbors decreases as the spatial distance between them and the center pixel increases. 
 
 .. note::
 
-   Remember that a 2D Gaussian can be represented as :
+   Remember that a 2D Gaussian can be represented as :
    
-     .. math::
+   .. math::
      
-        G_{0}(x, y) = A  e^{ \dfrac{ -(x - \mu_{x})^{2} }{ 2\sigma^{2}_{x} } +  \dfrac{ -(y - \mu_{y})^{2} }{ 2\sigma^{2}_{y} } }
-
-     where :math:`\mu` is the mean (the peak) and :math:`\sigma` represents the variance (per each of the variables :math:`x` and :math:`y`)
+      G_{0}(x, y) = A  e^{ \dfrac{ -(x - \mu_{x})^{2} }{ 2\sigma^{2}_{x} } +  \dfrac{ -(y - \mu_{y})^{2} }{ 2\sigma^{2}_{y} } }
 
+   where :math:`\mu` is the mean (the peak) and :math:`\sigma` represents the variance (per each of the variables :math:`x` and :math:`y`)
 
 
 Median Filter
@@ -88,19 +94,32 @@ The median filter run through each element of the signal (in this case the image
 Bilateral Filter
 -----------------
 
-* So far, we have explained some filters which main goal is to *smooth* an input image. However, sometimes the filters do not only dissolve the noise, but also smooth away the *edges*. To avoid this (at certain extent at least), we can use a bilateral filter.
+.. container:: enumeratevisibleitemswithsquare
 
-* In an analogous way as the Gaussian filter,  the bilateral filter also considers the neighboring pixels with  weights assigned to each of them. These weights have two components, the first of which is the same weighting used by the Gaussian filter. The second component takes into account the difference in intensity between the neighboring pixels and the evaluated one. 
-
-* For a more detailed explanation you can check `this link <http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html>`_  
+   * So far, we have explained some filters which main goal is to *smooth* an input image. However, sometimes the filters do not only dissolve the noise, but also smooth away the *edges*. To avoid this (at certain extent at least), we can use a bilateral filter.
 
+   * In an analogous way as the Gaussian filter,  the bilateral filter also considers the neighboring pixels with  weights assigned to each of them. These weights have two components, the first of which is the same weighting used by the Gaussian filter. The second component takes into account the difference in intensity between the neighboring pixels and the evaluated one. 
 
+   * For a more detailed explanation you can check `this link <http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html>`_  
 
 
 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/Smoothing.cpp>`_
+.. container:: enumeratevisibleitemswithsquare
+
+   * **What does this program do?**
+     .. container:: enumeratevisibleitemswithsquare
+
+        * Loads an image
+        * Applies 4 different kinds of filters (explained in Theory) and show the filtered images sequentially
+
+   * **Downloadable code**:
+     Click `here <https://code.ros.org/svn/opencv/trunk/opencv/samples/cpp/tutorial_code/ImgProc/Smoothing.cpp>`_
+
+   * **Code at glance:**
+
 
 .. code-block:: cpp
 
@@ -213,13 +232,15 @@ Explanation
 
    We specify 4 arguments (more details, check the Reference):
 
-   * *src*: Source image
+   .. container:: enumeratevisibleitemswithsquare
 
-   * *dst*: Destination image
+      + *src*: Source image
 
-   * *Size( w,h )*: Defines the size of the kernel to be used ( of width *w* pixels and height *h* pixels) 
+      + *dst*: Destination image
 
-   * *Point(-1, -1)*: Indicates where the anchor point (the pixel evaluated) is located with respect to the neighborhood. If there is a negative value, then the center of the kernel is considered the anchor point.  
+      + *Size( w,h )*: Defines the size of the kernel to be used ( of width *w* pixels and height *h* pixels) 
+
+      + *Point(-1, -1)*: Indicates where the anchor point (the pixel evaluated) is located with respect to the neighborhood. If there is a negative value, then the center of the kernel is considered the anchor point.  
     
 #. **Gaussian Filter:**
 
@@ -233,15 +254,17 @@ Explanation
 
    Here we use 4 arguments (more details, check the OpenCV reference):
 
-   * *src*: Source image
+   .. container:: enumeratevisibleitemswithsquare
+
+      + *src*: Source image
 
-   * *dst*: Destination image
+      + *dst*: Destination image
 
-   * *Size(w, h)*: The size of the kernel to be used (the neighbors to be considered). :math:`w` and :math:`h` have to be odd and positive numbers otherwise thi size will be calculated using the :math:`\sigma_{x}` and :math:`\sigma_{y}` arguments.
+      + *Size(w, h)*: The size of the kernel to be used (the neighbors to be considered). :math:`w` and :math:`h` have to be odd and positive numbers otherwise thi size will be calculated using the :math:`\sigma_{x}` and :math:`\sigma_{y}` arguments.
 
-   * :math:`\sigma_{x}`: The standard deviation in x. Writing :math:`0` implies that :math:`\sigma_{x}` is calculated using kernel size.
+      + :math:`\sigma_{x}`: The standard deviation in x. Writing :math:`0` implies that :math:`\sigma_{x}` is calculated using kernel size.
    
-   * :math:`\sigma_{y}`: The standard deviation in y. Writing :math:`0` implies that :math:`\sigma_{y}` is calculated using kernel size.
+      + :math:`\sigma_{y}`: The standard deviation in y. Writing :math:`0` implies that :math:`\sigma_{y}` is calculated using kernel size.
     
 
 #. **Median Filter:**
@@ -256,11 +279,13 @@ Explanation
 
    We use three arguments:
 
-   * *src*: Source image
+   .. container:: enumeratevisibleitemswithsquare
+
+      + *src*: Source image
 
-   * *dst*: Destination image, must be the same type as *src*
+      + *dst*: Destination image, must be the same type as *src*
    
-   * *i*: Size of the kernel (only one because we use a square window). Must be odd. 
+      + *i*: Size of the kernel (only one because we use a square window). Must be odd. 
 
 
 #. **Bilateral Filter**
@@ -275,24 +300,29 @@ Explanation
  
    We use 5 arguments:
 
-   * *src*: Source image
+   .. container:: enumeratevisibleitemswithsquare
 
-   * *dst*: Destination image
+      + *src*: Source image
 
-   * *d*: The diameter of each pixel neighborhood.
+      + *dst*: Destination image
+
+      + *d*: The diameter of each pixel neighborhood.
   
-   * :math:`\sigma_{Color}`: Standard deviation in the color space.
+      + :math:`\sigma_{Color}`: Standard deviation in the color space.
   
-   * :math:`\sigma_{Space}`: Standard deviation in the coordinate space (in pixel terms)
+      + :math:`\sigma_{Space}`: Standard deviation in the coordinate space (in pixel terms)
 
 
 Results
 ========
 
-* The code opens an image (in this case *lena.png*) and display it under the effects of the 4 filters explained. 
+.. container:: enumeratevisibleitemswithsquare
+
+   * The code opens an image (in this case *lena.png*) and display it under the effects of the 4 filters explained. 
 
-* Here is a snapshot of the image smoothed using *medianBlur*:
+   * Here is a snapshot of the image smoothed using *medianBlur*:
 
-  .. image:: images/Smoothing_Tutorial_Result_Median_Filter.png
-     :alt: Smoothing with a median filter
-     :align: center 
+     .. image:: images/Smoothing_Tutorial_Result_Median_Filter.jpg
+              :alt: Smoothing with a median filter
+              :height: 200pt
+              :align: center 
diff --git a/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Cover.png b/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Cover.png
deleted file mode 100644 (file)
index 4540617..0000000
Binary files a/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Cover.png and /dev/null differ
diff --git a/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Result_Median_Filter.jpg b/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Result_Median_Filter.jpg
new file mode 100644 (file)
index 0000000..38a822b
Binary files /dev/null and b/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Result_Median_Filter.jpg differ
diff --git a/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Result_Median_Filter.png b/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Result_Median_Filter.png
deleted file mode 100644 (file)
index b8cf7ca..0000000
Binary files a/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/images/Smoothing_Tutorial_Result_Median_Filter.png and /dev/null differ
diff --git a/doc/tutorials/imgproc/histograms/back_projection/back_projection.rst b/doc/tutorials/imgproc/histograms/back_projection/back_projection.rst
new file mode 100644 (file)
index 0000000..99925e1
--- /dev/null
@@ -0,0 +1,4 @@
+.. _back_projection:
+
+Back Projection
+****************
diff --git a/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_BackProj.jpg b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_BackProj.jpg
new file mode 100644 (file)
index 0000000..c45f747
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_BackProj.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_Histogram.jpg b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_Histogram.jpg
new file mode 100644 (file)
index 0000000..1ac0199
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_Histogram.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_Source_Image.jpg b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_Source_Image.jpg
new file mode 100644 (file)
index 0000000..3feb2a0
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection1_Source_Image.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_BackProj.jpg b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_BackProj.jpg
new file mode 100644 (file)
index 0000000..b805302
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_BackProj.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_Mask.jpg b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_Mask.jpg
new file mode 100644 (file)
index 0000000..2684f06
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_Mask.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_Source_Image.jpg b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_Source_Image.jpg
new file mode 100644 (file)
index 0000000..3323368
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/back_projection/images/Back_Projection2_Source_Image.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_calculation/histogram_calculation.rst b/doc/tutorials/imgproc/histograms/histogram_calculation/histogram_calculation.rst
new file mode 100644 (file)
index 0000000..729c14d
--- /dev/null
@@ -0,0 +1,4 @@
+.. _histogram_calculation:
+
+Histogram Calculation
+**********************
diff --git a/doc/tutorials/imgproc/histograms/histogram_calculation/images/Histogram_Calculation_Original_Image.jpg b/doc/tutorials/imgproc/histograms/histogram_calculation/images/Histogram_Calculation_Original_Image.jpg
new file mode 100644 (file)
index 0000000..06d6e32
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_calculation/images/Histogram_Calculation_Original_Image.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_calculation/images/Histogram_Calculation_Result.jpg b/doc/tutorials/imgproc/histograms/histogram_calculation/images/Histogram_Calculation_Result.jpg
new file mode 100644 (file)
index 0000000..4915557
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_calculation/images/Histogram_Calculation_Result.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.rst b/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.rst
new file mode 100644 (file)
index 0000000..6db26e0
--- /dev/null
@@ -0,0 +1,4 @@
+.. _histogram_comparison:
+
+Histogram Comparison
+********************
diff --git a/doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_0.jpg b/doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_0.jpg
new file mode 100644 (file)
index 0000000..4c42898
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_0.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_1.jpg b/doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_1.jpg
new file mode 100644 (file)
index 0000000..8ca11f9
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_1.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_2.jpg b/doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_2.jpg
new file mode 100644 (file)
index 0000000..bd339a0
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_comparison/images/Histogram_Comparison_Source_2.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_equalization/histogram_equalization.rst b/doc/tutorials/imgproc/histograms/histogram_equalization/histogram_equalization.rst
new file mode 100644 (file)
index 0000000..e88fe94
--- /dev/null
@@ -0,0 +1,224 @@
+.. _histogram_equalization:
+
+Histogram Equalization
+**********************
+
+Goal
+====
+
+In this tutorial you will learn:
+
+.. container:: enumeratevisibleitemswithsquare
+
+   * What an image histogram is and why it is useful
+
+   * To equalize histograms of images by using the OpenCV function:equalize_hist:`equalizeHist <>` 
+
+
+
+Theory
+======
+
+What is an Image Histogram?
+---------------------------
+
+.. container:: enumeratevisibleitemswithsquare
+
+   * It is a graphical representation of the intensity distribution of an image. 
+
+   * It quantifies the number of pixels for each intensity value considered.
+
+.. image:: images/Histogram_Equalization_Theory_0.jpg
+        :height: 200pt
+        :align: center 
+
+
+What is Histogram Equalization?
+-------------------------------
+
+.. container:: enumeratevisibleitemswithsquare
+
+   * It is a method that improves the contrast in an image, in order to stretch out the intensity range.
+
+   * To make it clearer, from the image above, you can see that the pixels seem clustered around the middle of the available range of intensities. What Histogram Equalization does is to *stretch out* this range. Take a look at the figure below: The green circles indicate the *underpopulated* intensities. After applying the equalization, we get an histogram like the figure in the center. The resulting image is shown in the picture at right.
+
+.. image:: images/Histogram_Equalization_Theory_1.jpg
+          :height: 200pt
+          :align: center 
+
+How does it work?
+-----------------
+
+.. container:: enumeratevisibleitemswithsquare
+
+   * Equalization implies *mapping* one distribution (the given histogram) to another distribution (a wider and more uniform distribution of intensity values) so the intensity values are spreaded over the whole range. 
+
+   * To accomplish the equalization effect, the remapping should be the *cumulative distribution function (cdf)* (more details, refer to *Learning OpenCV*). For the histogram :math:`H(i)`, its *cumulative distribution* :math:`H^{'}(i)` is:
+
+     .. math::
+
+        H^{'}(i) = \sum_{0 \le j < i} H(j) 
+
+     To use this as a remapping function, we have to normalize :math:`H^{'}(i)` such that the maximum value is 255 ( or the maximum value for the intensity of the image ). From the example above, the cumulative function is:
+
+     .. image:: images/Histogram_Equalization_Theory_2.jpg
+              :height: 200pt
+              :align: center 
+
+   * Finally, we use a simple remapping procedure to obtain the intensity values of the equalized image:
+
+     .. math::
+        equalized( x, y ) = H^{'}( src(x,y) )
+
+Code
+====
+
+.. container:: enumeratevisibleitemswithsquare
+
+   * **What does this program do?**
+     .. container:: enumeratevisibleitemswithsquare
+
+        * Loads an image
+        * Convert the original image to grayscale 
+        * Equalize the Histogram by using the OpenCV function :equalize_hist:`EqualizeHist <>`
+        * Display the source and equalized images in a window.
+
+   * **Downloadable code**:
+     Click `here <https://code.ros.org/svn/opencv/trunk/opencv/samples/cpp/tutorial_code/Histograms_Matching/EqualizeHist_Demo.cpp>`_
+
+   * **Code at glance:**
+
+.. code-block:: cpp
+
+   #include "opencv2/highgui/highgui.hpp"
+   #include "opencv2/imgproc/imgproc.hpp"
+   #include <iostream>
+   #include <stdio.h>
+
+   using namespace cv;
+   using namespace std;
+
+   /**  @function main */
+   int main( int argc, char** argv )
+   {
+     Mat src, dst;
+
+     char* source_window = "Source image";
+     char* equalized_window = "Equalized Image";
+
+     /// Load image
+     src = imread( argv[1], 1 );
+
+     if( !src.data )
+       { cout<<"Usage: ./Histogram_Demo <path_to_image>"<<endl;
+         return -1;}
+
+     /// Convert to grayscale
+     cvtColor( src, src, CV_BGR2GRAY );
+
+     /// Apply Histogram Equalization
+     equalizeHist( src, dst );
+     /// Display results
+     namedWindow( source_window, CV_WINDOW_AUTOSIZE );
+     namedWindow( equalized_window, CV_WINDOW_AUTOSIZE );
+
+     imshow( source_window, src );
+     imshow( equalized_window, dst );
+     /// Wait until user exits the program 
+     waitKey(0);
+
+     return 0;
+   }
+
+Explanation
+===========
+
+#. Declare the source and destination images as well as the windows names:  
+
+   .. code-block:: cpp
+
+      Mat src, dst;
+
+      char* source_window = "Source image";
+      char* equalized_window = "Equalized Image";
+
+#. Load the source image:
+   .. code-block:: cpp
+
+      src = imread( argv[1], 1 );
+
+      if( !src.data )
+        { cout<<"Usage: ./Histogram_Demo <path_to_image>"<<endl;
+          return -1;}
+
+#. Convert it to grayscale:
+
+   ..  code-block:: cpp
+
+       cvtColor( src, src, CV_BGR2GRAY );
+
+#. Apply histogram equalization with the function :equalize_hist:`equalizeHist <>` :
+
+   .. code-block:: cpp
+
+      equalizeHist( src, dst );
+   As it can  be easily seen, the only arguments are the original image and the output (equalized) image.
+
+#. Display both images (original and equalized) :
+
+   .. code-block::  cpp
+
+      namedWindow( source_window, CV_WINDOW_AUTOSIZE );
+      namedWindow( equalized_window, CV_WINDOW_AUTOSIZE );
+
+      imshow( source_window, src );
+      imshow( equalized_window, dst );
+#. Wait until user exists the program
+     
+   .. code-block:: cpp
+
+      waitKey(0);
+      return 0;
+
+
+Results
+=======
+
+#. To appreciate better the results of equalization, let's introduce an image with not much contrast, such as:
+
+   .. image:: images/Histogram_Equalization_Original_Image.jpg
+            :height: 200pt
+            :align: center 
+
+   which, by the way, has this histogram:
+
+   .. image:: images/Histogram_Equalization_Original_Histogram.jpg
+            :height: 150pt
+            :align: center 
+
+   notice that the pixels are clustered around the center of the histogram.
+
+#. After applying the equalization with our program, we get this result:
+
+   .. image:: images/Histogram_Equalization_Equalized_Image.jpg
+            :height: 200pt
+            :align: center 
+
+   this image has certainly more contrast. Check out its new histogram like this:
+
+   .. image:: images/Histogram_Equalization_Equalized_Histogram.jpg
+            :height: 150pt
+            :align: center
+
+   Notice how the number of pixels is more distributed through the intensity range.
+
+
+.. note::
+   Are you wondering how did we draw the Histogram figures shown above? Check out the following tutorial!
diff --git a/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Equalized_Histogram.jpg b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Equalized_Histogram.jpg
new file mode 100644 (file)
index 0000000..59572af
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Equalized_Histogram.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Equalized_Image.jpg b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Equalized_Image.jpg
new file mode 100644 (file)
index 0000000..3992ed2
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Equalized_Image.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Original_Histogram.jpg b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Original_Histogram.jpg
new file mode 100644 (file)
index 0000000..4177a96
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Original_Histogram.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Original_Image.jpg b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Original_Image.jpg
new file mode 100644 (file)
index 0000000..bb16964
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Original_Image.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_0.jpg b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_0.jpg
new file mode 100644 (file)
index 0000000..c9aa79d
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_0.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_1.jpg b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_1.jpg
new file mode 100644 (file)
index 0000000..6894d2b
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_1.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_2.jpg b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_2.jpg
new file mode 100644 (file)
index 0000000..cc2496e
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/histogram_equalization/images/Histogram_Equalization_Theory_2.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_0.jpg b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_0.jpg
new file mode 100644 (file)
index 0000000..cd3edb4
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_0.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_1.jpg b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_1.jpg
new file mode 100644 (file)
index 0000000..f84e599
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_1.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_2.jpg b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_2.jpg
new file mode 100644 (file)
index 0000000..df0de48
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_2.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_3.jpg b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_3.jpg
new file mode 100644 (file)
index 0000000..e905695
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_3.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_4.jpg b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_4.jpg
new file mode 100644 (file)
index 0000000..ff99705
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_4.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_5.jpg b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_5.jpg
new file mode 100644 (file)
index 0000000..e8c4183
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Correl_Result_5.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Image_Result.jpg b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Image_Result.jpg
new file mode 100644 (file)
index 0000000..601ca6f
Binary files /dev/null and b/doc/tutorials/imgproc/histograms/template_matching/images/Template_Matching_Image_Result.jpg differ
diff --git a/doc/tutorials/imgproc/histograms/template_matching/template_matching.rst b/doc/tutorials/imgproc/histograms/template_matching/template_matching.rst
new file mode 100644 (file)
index 0000000..066a40f
--- /dev/null
@@ -0,0 +1,4 @@
+.. _template_matching:
+
+Template Matching
+*****************
diff --git a/doc/tutorials/imgproc/table_of_content_imgproc/images/Smoothing_Tutorial_Cover.jpg b/doc/tutorials/imgproc/table_of_content_imgproc/images/Smoothing_Tutorial_Cover.jpg
new file mode 100644 (file)
index 0000000..c471fb4
Binary files /dev/null and b/doc/tutorials/imgproc/table_of_content_imgproc/images/Smoothing_Tutorial_Cover.jpg differ
diff --git a/doc/tutorials/imgproc/table_of_content_imgproc/images/Smoothing_Tutorial_Cover.png b/doc/tutorials/imgproc/table_of_content_imgproc/images/Smoothing_Tutorial_Cover.png
deleted file mode 100644 (file)
index f05676b..0000000
Binary files a/doc/tutorials/imgproc/table_of_content_imgproc/images/Smoothing_Tutorial_Cover.png and /dev/null differ
diff --git a/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Back_Projection_Tutorial_Cover.jpg b/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Back_Projection_Tutorial_Cover.jpg
new file mode 100644 (file)
index 0000000..c45f747
Binary files /dev/null and b/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Back_Projection_Tutorial_Cover.jpg differ
diff --git a/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Calculation_Tutorial_Cover.jpg b/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Calculation_Tutorial_Cover.jpg
new file mode 100644 (file)
index 0000000..4915557
Binary files /dev/null and b/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Calculation_Tutorial_Cover.jpg differ
diff --git a/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Comparison_Tutorial_Cover.jpg b/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Comparison_Tutorial_Cover.jpg
new file mode 100644 (file)
index 0000000..5ab4327
Binary files /dev/null and b/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Comparison_Tutorial_Cover.jpg differ
diff --git a/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Equalization_Tutorial_Cover.jpg b/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Equalization_Tutorial_Cover.jpg
new file mode 100644 (file)
index 0000000..d01ad5e
Binary files /dev/null and b/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Histogram_Equalization_Tutorial_Cover.jpg differ
diff --git a/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Template_Matching_Tutorial_Cover.jpg b/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Template_Matching_Tutorial_Cover.jpg
new file mode 100644 (file)
index 0000000..08d49f1
Binary files /dev/null and b/doc/tutorials/imgproc/table_of_content_imgproc/images/histograms/Template_Matching_Tutorial_Cover.jpg differ
index aa91c2b..5986ca3 100644 (file)
@@ -24,7 +24,7 @@ In this section you will learn about the image processing (manipulation) functio
   \r
   ===================== ==============================================\r
   \r
-  .. |ImageProcessing_1| image:: images/Smoothing_Tutorial_Cover.png\r
+  .. |ImageProcessing_1| image:: images/Smoothing_Tutorial_Cover.jpg\r
                          :height: 90pt\r
                          :width:  90pt\r
   \r
@@ -283,21 +283,111 @@ In this section you will learn about the image processing (manipulation) functio
   .. |WarpAffine| image:: images/imgtrans/Warp_Affine_Tutorial_Cover.jpg\r
                         :height: 90pt\r
                         :width:  90pt\r
+\r
++ \r
+\r
+  .. tabularcolumns:: m{100pt} m{300pt}\r
+  .. cssclass:: toctableopencv\r
+  \r
+  ===================== ==============================================\r
+   |HistEqualization|   **Title:** :ref:`histogram_equalization`\r
+\r
+                        *Compatibility:* > OpenCV 2.0\r
+                        \r
+                        *Author:* |Author_AnaH|\r
+\r
+                        Where we learn how to improve the contrast in our images\r
+\r
+  ===================== ==============================================\r
+  \r
+  .. |HistEqualization| image:: images/histograms/Histogram_Equalization_Tutorial_Cover.jpg\r
+                              :height: 90pt\r
+                              :width:  90pt\r
+\r
++ \r
+\r
+  .. tabularcolumns:: m{100pt} m{300pt}\r
+  .. cssclass:: toctableopencv\r
+  \r
+  ===================== ==============================================\r
+   |HistCalculation|    **Title:** :ref:`histogram_calculation`\r
+\r
+                        *Compatibility:* > OpenCV 2.0\r
+                        \r
+                        *Author:* |Author_AnaH|\r
+\r
+                        Where we learn how to create and generate histograms\r
+\r
+  ===================== ==============================================\r
+  \r
+  .. |HistCalculation| image:: images/histograms/Histogram_Calculation_Tutorial_Cover.jpg\r
+                             :height: 90pt\r
+                             :width:  90pt\r
+\r
++ \r
+\r
+  .. tabularcolumns:: m{100pt} m{300pt}\r
+  .. cssclass:: toctableopencv\r
+  \r
+  ===================== ==============================================\r
+   |HistComparison|     **Title:** :ref:`histogram_comparison`\r
+\r
+                        *Compatibility:* > OpenCV 2.0\r
+                        \r
+                        *Author:* |Author_AnaH|\r
+\r
+                        Where we learn to calculate metrics between histograms\r
+\r
+  ===================== ==============================================\r
+  \r
+  .. |HistComparison| image:: images/histograms/Histogram_Comparison_Tutorial_Cover.jpg\r
+                            :height: 90pt\r
+                            :width:  90pt\r
+\r
++ \r
+\r
+  .. tabularcolumns:: m{100pt} m{300pt}\r
+  .. cssclass:: toctableopencv\r
+  \r
+  ===================== ==============================================\r
+   |BackProjection|     **Title:** :ref:`back_projection`\r
+\r
+                        *Compatibility:* > OpenCV 2.0\r
+                        \r
+                        *Author:* |Author_AnaH|\r
+\r
+                        Where we learn how to use histograms to find similar objects in images\r
+\r
+  ===================== ==============================================\r
+  \r
+  .. |BackProjection| image:: images/histograms/Back_Projection_Tutorial_Cover.jpg\r
+                            :height: 90pt\r
+                            :width:  90pt\r
+\r
++ \r
+\r
+  .. tabularcolumns:: m{100pt} m{300pt}\r
+  .. cssclass:: toctableopencv\r
+  \r
+  ===================== ==============================================\r
+   |TemplateMatching|   **Title:** :ref:`template_matching`\r
+\r
+                        *Compatibility:* > OpenCV 2.0\r
+                        \r
+                        *Author:* |Author_AnaH|\r
+\r
+                        Where we learn how to match templates in an image\r
+\r
+  ===================== ==============================================\r
+  \r
+  .. |TemplateMatching| image:: images/histograms/Template_Matching_Tutorial_Cover.jpg\r
+                              :height: 90pt\r
+                              :width:  90pt\r
+\r
   \r
 .. toctree::\r
    :hidden:\r
 \r
-   ../gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter\r
-   ../erosion_dilatation/erosion_dilatation\r
-   ../opening_closing_hats/opening_closing_hats\r
-   ../pyramids/pyramids\r
-   ../threshold/threshold\r
-   ../imgtrans/filter_2d/filter_2d\r
-   ../imgtrans/copyMakeBorder/copyMakeBorder\r
-   ../imgtrans/sobel_derivatives/sobel_derivatives\r
-   ../imgtrans/laplace_operator/laplace_operator\r
-   ../imgtrans/canny_detector/canny_detector\r
-   ../imgtrans/hough_lines/hough_lines\r
-   ../imgtrans/hough_circle/hough_circle\r
-   ../imgtrans/remap/remap\r
-   ../imgtrans/warp_affine/warp_affine\r
+\r
+\r
+\r