Ok, now optimized the tutorial size for real. Made JPG/PNG optimization for all the images. Modified some tutorial files to follow these size optimizations. Now the tutorial PDF generated is 3.95MB, so enjoy!
@@ -34,9 +34,8 @@ Morphological Operations
 | 
			
		||||
 | 
			
		||||
* We will explain dilation and erosion briefly, using the following image as an example:
 | 
			
		||||
 | 
			
		||||
  .. image:: images/Morphology_1_Tutorial_Theory_Original_Image.jpg
 | 
			
		||||
  .. image:: images/Morphology_1_Tutorial_Theory_Original_Image.png
 | 
			
		||||
     :alt: Original image
 | 
			
		||||
     :height: 100px
 | 
			
		||||
     :align: center 
 | 
			
		||||
 | 
			
		||||
Dilation
 | 
			
		||||
@@ -48,9 +47,8 @@ Dilation
 | 
			
		||||
 | 
			
		||||
* As the kernel :math:`B` is scanned over the image, we compute the maximal pixel value overlapped by :math:`B` and replace the image pixel in the anchor point position with that maximal value. As you can deduce, this maximizing operation causes bright regions within an image to "grow" (therefore the name *dilation*). Take as an example the image above. Applying dilation we can get:
 | 
			
		||||
 | 
			
		||||
  .. image:: images/Morphology_1_Tutorial_Theory_Dilation.jpg
 | 
			
		||||
  .. image:: images/Morphology_1_Tutorial_Theory_Dilation.png
 | 
			
		||||
     :alt: Dilation result - Theory example
 | 
			
		||||
     :height: 100px
 | 
			
		||||
     :align: center 
 | 
			
		||||
 | 
			
		||||
The background (bright) dilates around the black regions of the letter.
 | 
			
		||||
@@ -64,9 +62,8 @@ Erosion
 | 
			
		||||
 | 
			
		||||
* Analagously to the example for dilation, we can apply the erosion operator to the original image (shown above). You can see in the result below that the bright areas of the image (the background, apparently), get thinner, whereas the dark zones (the "writing"( gets bigger.
 | 
			
		||||
 | 
			
		||||
  .. image:: images/Morphology_1_Tutorial_Theory_Erosion.jpg
 | 
			
		||||
  .. image:: images/Morphology_1_Tutorial_Theory_Erosion.png
 | 
			
		||||
     :alt: Erosion result - Theory example
 | 
			
		||||
     :height: 100px
 | 
			
		||||
     :align: center 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -268,13 +265,10 @@ Results
 | 
			
		||||
 | 
			
		||||
  .. image:: images/Morphology_1_Tutorial_Original_Image.jpg
 | 
			
		||||
     :alt: Original image
 | 
			
		||||
     :height: 200px
 | 
			
		||||
     :align: center 
 | 
			
		||||
 | 
			
		||||
  We get the results below. Varying the indices in the Trackbars give different output images, naturally. Try them out! You can even try to add a third Trackbar to control the number of iterations.
 | 
			
		||||
 | 
			
		||||
  .. image:: images/Morphology_1_Tutorial_Cover.jpg
 | 
			
		||||
     :alt: Dilation and Erosion application
 | 
			
		||||
     :height: 400px
 | 
			
		||||
     :align: center 
 | 
			
		||||
 
 | 
			
		||||
     :align: center 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 26 KiB  | 
| 
		 Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 16 KiB  | 
| 
		 Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 18 KiB  | 
| 
		 Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 14 KiB  | 
| 
		 Before Width: | Height: | Size: 18 KiB  | 
| 
		 After Width: | Height: | Size: 410 B  | 
| 
		 Before Width: | Height: | Size: 19 KiB  | 
| 
		 After Width: | Height: | Size: 457 B  | 
| 
		 Before Width: | Height: | Size: 19 KiB  | 
| 
		 After Width: | Height: | Size: 458 B  | 
@@ -69,7 +69,6 @@ Gaussian Filter
 | 
			
		||||
   * Just to make the picture clearer, remember how a 1D Gaussian kernel look like?
 | 
			
		||||
 | 
			
		||||
     .. 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. 
 | 
			
		||||
@@ -324,5 +323,4 @@ Results
 | 
			
		||||
 | 
			
		||||
     .. image:: images/Smoothing_Tutorial_Result_Median_Filter.jpg
 | 
			
		||||
              :alt: Smoothing with a median filter
 | 
			
		||||
              :height: 200pt
 | 
			
		||||
              :align: center 
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 15 KiB  | 
@@ -47,11 +47,9 @@ How does it work?
 | 
			
		||||
     ======  ======   
 | 
			
		||||
 | 
			
		||||
     .. |T0| image:: images/Back_Projection_Theory0.jpg
 | 
			
		||||
                   :height: 200pt
 | 
			
		||||
                   :align: middle
 | 
			
		||||
 | 
			
		||||
     .. |T1| image:: images/Back_Projection_Theory1.jpg
 | 
			
		||||
                   :height: 200pt
 | 
			
		||||
                   :align: middle
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -62,11 +60,9 @@ How does it work?
 | 
			
		||||
     ======  ======   
 | 
			
		||||
 | 
			
		||||
     .. |T2| image:: images/Back_Projection_Theory2.jpg
 | 
			
		||||
                   :height: 200pt
 | 
			
		||||
                   :align: middle
 | 
			
		||||
 | 
			
		||||
     .. |T3| image:: images/Back_Projection_Theory3.jpg
 | 
			
		||||
                   :height: 200pt
 | 
			
		||||
                   :align: middle
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -81,7 +77,6 @@ How does it work?
 | 
			
		||||
     d. Applying the steps above, we get the following BackProjection image for our Test Image:
 | 
			
		||||
 | 
			
		||||
        .. image:: images/Back_Projection_Theory4.jpg
 | 
			
		||||
                 :height: 200pt
 | 
			
		||||
                 :align: center
 | 
			
		||||
 | 
			
		||||
     e. In terms of statistics, the values stored in *BackProjection* represent the *probability* that a pixel in *Test Image* belongs to a skin area, based on the *model histogram* that we use. For instance in our Test image, the brighter areas are more probable to be skin area (as they actually are), whereas the darker areas have less probability (notice that these "dark" areas belong to surfaces that have some shadow on it, which in turns affects the detection).
 | 
			
		||||
@@ -301,13 +296,10 @@ Results
 | 
			
		||||
   ======  ======  ====== 
 | 
			
		||||
 | 
			
		||||
   .. |R0| image:: images/Back_Projection1_Source_Image.jpg
 | 
			
		||||
                 :height: 200pt
 | 
			
		||||
                 :align: middle
 | 
			
		||||
 | 
			
		||||
   .. |R1| image:: images/Back_Projection1_Histogram.jpg
 | 
			
		||||
                 :height: 200pt
 | 
			
		||||
                 :align: middle
 | 
			
		||||
 | 
			
		||||
   .. |R2| image:: images/Back_Projection1_BackProj.jpg
 | 
			
		||||
                 :height: 200pt
 | 
			
		||||
                 :align: middle
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 5.2 KiB  | 
| 
		 Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 3.2 KiB  | 
| 
		 Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 7.6 KiB  | 
| 
		 Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 8.9 KiB  | 
| 
		 Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 8.8 KiB  | 
| 
		 Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 8.4 KiB  | 
| 
		 Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 8.6 KiB  | 
| 
		 Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 1.3 KiB  | 
| 
		 Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 5.4 KiB  | 
| 
		 Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 2.0 KiB  | 
| 
		 Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 7.4 KiB  | 
@@ -34,7 +34,6 @@ What are histograms?
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
     .. image:: images/Histogram_Calculation_Theory_Hist0.jpg
 | 
			
		||||
              :height: 300pt
 | 
			
		||||
              :align: center   
 | 
			
		||||
 | 
			
		||||
   * What happens if we want to *count* this data in an organized way? Since we know that the *range* of information value for this case is 256 values, we can segment our range in subparts (called **bins**) like:
 | 
			
		||||
@@ -49,7 +48,6 @@ What are histograms?
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
     .. image:: images/Histogram_Calculation_Theory_Hist1.jpg
 | 
			
		||||
              :height: 150pt
 | 
			
		||||
              :align: center 
 | 
			
		||||
 | 
			
		||||
   * This was just a simple example of how an histogram works and why it is useful. An histogram can keep count not only of color intensities, but of whatever image features that we want to measure (i.e. gradients, directions, etc). 
 | 
			
		||||
@@ -324,12 +322,10 @@ Result
 | 
			
		||||
#. Using as input argument an image like the shown below:
 | 
			
		||||
 | 
			
		||||
     .. image:: images/Histogram_Calculation_Original_Image.jpg
 | 
			
		||||
              :height: 150pt
 | 
			
		||||
              :align: center   
 | 
			
		||||
 | 
			
		||||
#. Produces the following histogram:
 | 
			
		||||
 | 
			
		||||
     .. image:: images/Histogram_Calculation_Result.jpg
 | 
			
		||||
              :height: 200pt
 | 
			
		||||
              :align: center   
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 19 KiB  | 
| 
		 Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 9.9 KiB  | 
| 
		 Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 62 KiB  | 
| 
		 Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 9.3 KiB  | 
@@ -272,15 +272,12 @@ Results
 | 
			
		||||
   ============  ============  ============ 
 | 
			
		||||
 | 
			
		||||
   .. |Base_0| image:: images/Histogram_Comparison_Source_0.jpg
 | 
			
		||||
                    :height: 150pt
 | 
			
		||||
                    :align: middle
 | 
			
		||||
 | 
			
		||||
   .. |Test_1| image:: images/Histogram_Comparison_Source_1.jpg
 | 
			
		||||
                      :height: 150pt
 | 
			
		||||
                      :align: middle
 | 
			
		||||
 | 
			
		||||
   .. |Test_2| image:: images/Histogram_Comparison_Source_2.jpg
 | 
			
		||||
                      :height: 150pt
 | 
			
		||||
                      :align: middle
 | 
			
		||||
 | 
			
		||||
   where the first one is the base (to be compared to the others), the other 2 are the test images. We will also compare the first image with respect to itself and with respect of half the base image.
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 8.6 KiB  | 
| 
		 Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 5.3 KiB  | 
| 
		 Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 3.4 KiB  | 
@@ -29,7 +29,6 @@ What is an Image Histogram?
 | 
			
		||||
   * It quantifies the number of pixels for each intensity value considered.
 | 
			
		||||
 | 
			
		||||
.. image:: images/Histogram_Equalization_Theory_0.jpg
 | 
			
		||||
        :height: 200pt
 | 
			
		||||
        :align: center 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -43,7 +42,6 @@ What is Histogram Equalization?
 | 
			
		||||
   * 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?
 | 
			
		||||
@@ -62,7 +60,6 @@ How does it work?
 | 
			
		||||
     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:
 | 
			
		||||
@@ -194,13 +191,11 @@ 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.
 | 
			
		||||
@@ -208,13 +203,11 @@ Results
 | 
			
		||||
#. 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.
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 7.2 KiB  | 
| 
		 Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 14 KiB  | 
| 
		 Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 4.9 KiB  | 
| 
		 Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 11 KiB  | 
| 
		 Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 18 KiB  | 
| 
		 Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 18 KiB  | 
| 
		 Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 3.6 KiB  | 
| 
		 Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 8.0 KiB  | 
| 
		 Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 9.6 KiB  | 
| 
		 Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 8.2 KiB  | 
| 
		 Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 9.6 KiB  | 
| 
		 Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 10 KiB  | 
| 
		 Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 22 KiB  | 
| 
		 Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 16 KiB  | 
| 
		 Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 7.9 KiB  | 
| 
		 Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 20 KiB  | 
| 
		 Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 16 KiB  | 
@@ -37,13 +37,11 @@ How does it work?
 | 
			
		||||
     our goal is to detect the highest matching area:
 | 
			
		||||
 | 
			
		||||
     .. image:: images/Template_Matching_Template_Theory_Summary.jpg
 | 
			
		||||
              :height: 200pt
 | 
			
		||||
              :align: center      
 | 
			
		||||
 | 
			
		||||
   * To identify the matching area, we have to *compare* the template image against the source image by sliding it:
 | 
			
		||||
 | 
			
		||||
     .. image:: images/Template_Matching_Template_Theory_Sliding.jpg
 | 
			
		||||
              :height: 200pt
 | 
			
		||||
              :align: center      
 | 
			
		||||
 | 
			
		||||
   *  By **sliding**, we mean moving the patch one pixel at a time (left to right, up to down). At each location, a metric is calculated so it represents how "good" or "bad" the match at that location is (or how similar the patch is to that particular area of the source image).
 | 
			
		||||
@@ -51,7 +49,6 @@ How does it work?
 | 
			
		||||
   *  For each location of **T** over **I**, you *store* the metric in the *result matrix* **(R)**. Each location :math:`(x,y)` in **R** contains the match metric:
 | 
			
		||||
 | 
			
		||||
      .. image:: images/Template_Matching_Template_Theory_Result.jpg
 | 
			
		||||
               :height: 200pt
 | 
			
		||||
               :align: center      
 | 
			
		||||
 | 
			
		||||
      the image above is the result **R** of sliding the patch with a metric **TM_CCORR_NORMED**. The brightest locations indicate the highest matches. As you can see, the location marked by the red circle is probably the one with the highest value, so that location (the rectangle formed by that point as a corner and width and height equal to the patch image) is considered the match. 
 | 
			
		||||
@@ -335,13 +332,11 @@ Results
 | 
			
		||||
#. Testing our program with an input image such as:
 | 
			
		||||
 | 
			
		||||
   .. image:: images/Template_Matching_Original_Image.jpg
 | 
			
		||||
            :height: 200pt
 | 
			
		||||
            :align: center
 | 
			
		||||
 
 | 
			
		||||
   and a template image:
 | 
			
		||||
 | 
			
		||||
   .. image:: images/Template_Matching_Template_Image.jpg
 | 
			
		||||
            :height: 50pt
 | 
			
		||||
            :align: center  
 | 
			
		||||
 | 
			
		||||
#. Generate the following result matrices (first row are the standard methods SQDIFF, CCORR and CCOEFF, second row are the same methods in its normalized version). In the first column, the darkest is the better match, for the other two columns, the brighter a location, the higher the match.
 | 
			
		||||
@@ -353,32 +348,25 @@ Results
 | 
			
		||||
   ============  ============  ============ 
 | 
			
		||||
 | 
			
		||||
   .. |Result_0| image:: images/Template_Matching_Correl_Result_0.jpg
 | 
			
		||||
                      :height: 150pt
 | 
			
		||||
                      :align: middle
 | 
			
		||||
 | 
			
		||||
   .. |Result_1| image:: images/Template_Matching_Correl_Result_1.jpg
 | 
			
		||||
                      :height: 150pt
 | 
			
		||||
                      :align: middle
 | 
			
		||||
 | 
			
		||||
   .. |Result_2| image:: images/Template_Matching_Correl_Result_2.jpg
 | 
			
		||||
                      :height: 150pt
 | 
			
		||||
                      :align: middle
 | 
			
		||||
 | 
			
		||||
   .. |Result_3| image:: images/Template_Matching_Correl_Result_3.jpg
 | 
			
		||||
                      :height: 150pt
 | 
			
		||||
                      :align: middle
 | 
			
		||||
 | 
			
		||||
   .. |Result_4| image:: images/Template_Matching_Correl_Result_4.jpg
 | 
			
		||||
                      :height: 150pt
 | 
			
		||||
                      :align: middle
 | 
			
		||||
 | 
			
		||||
   .. |Result_5| image:: images/Template_Matching_Correl_Result_5.jpg
 | 
			
		||||
                      :height: 150pt
 | 
			
		||||
                      :align: middle
 | 
			
		||||
 | 
			
		||||
#. The right match is shown below (black rectangle around the face of the guy at the right). Notice that CCORR and CCDEFF gave erroneous best matches, however their normalized version did it right, this may be due to the fact that we are only considering the "highest match" and not the other possible high matches.
 | 
			
		||||
 | 
			
		||||
   .. image:: images/Template_Matching_Image_Result.jpg
 | 
			
		||||
            :height: 200pt
 | 
			
		||||
            :align: center
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 15 KiB  | 
| 
		 Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 28 KiB  | 
| 
		 Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 20 KiB  | 
@@ -25,7 +25,7 @@ What is a kernel?
 | 
			
		||||
------------------
 | 
			
		||||
A kernel is essentially a fixed size array of numerical coefficeints along with an *anchor point* in that array, which is tipically located at the center. 
 | 
			
		||||
 | 
			
		||||
.. image:: images/filter_2d_tutorial_kernel_theory.jpg
 | 
			
		||||
.. image:: images/filter_2d_tutorial_kernel_theory.png
 | 
			
		||||
        :alt: kernel example
 | 
			
		||||
        :align: center 
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 14 KiB  | 
| 
		 After Width: | Height: | Size: 3.4 KiB  | 
| 
		 Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 15 KiB  | 
@@ -26,7 +26,6 @@ Hough Circle Transform
 | 
			
		||||
 | 
			
		||||
  .. image:: images/Hough_Circle_Tutorial_Theory_0.jpg
 | 
			
		||||
          :alt: Result of detecting circles with Hough Transform
 | 
			
		||||
          :height: 200pt
 | 
			
		||||
          :align: center 
 | 
			
		||||
 | 
			
		||||
* For sake of efficiency, OpenCV implements a detection method slightly trickier than the standard Hough Transform: *The Hough gradient method*. For more details, please check the book *Learning OpenCV* or your favorite Computer Vision bibliography
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 18 KiB  | 
| 
		 Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 7.1 KiB  | 
@@ -31,7 +31,6 @@ How does it work?
 | 
			
		||||
 | 
			
		||||
   .. image:: images/Hough_Lines_Tutorial_Theory_0.jpg
 | 
			
		||||
      :alt: Line variables
 | 
			
		||||
      :height: 200pt
 | 
			
		||||
      :align: center 
 | 
			
		||||
 | 
			
		||||
   For Hough Transforms, we will express lines in the *Polar system*. Hence, a line equation can be written as: 
 | 
			
		||||
@@ -54,7 +53,6 @@ How does it work?
 | 
			
		||||
 | 
			
		||||
   .. image:: images/Hough_Lines_Tutorial_Theory_1.jpg
 | 
			
		||||
      :alt: Polar plot of a the family of lines of a point
 | 
			
		||||
      :height: 200pt
 | 
			
		||||
      :align: center 
 | 
			
		||||
 | 
			
		||||
   We consider only points such that :math:`r > 0` and :math:`0< \theta < 2 \pi`. 
 | 
			
		||||
@@ -63,7 +61,6 @@ How does it work?
 | 
			
		||||
 | 
			
		||||
   .. image:: images/Hough_Lines_Tutorial_Theory_2.jpg
 | 
			
		||||
      :alt: Polar plot of the family of lines for three points
 | 
			
		||||
      :height: 200pt
 | 
			
		||||
      :align: center 
 | 
			
		||||
 | 
			
		||||
   The three plots intersect in one single point :math:`(0.925, 9.6)`, these coordinates are the parameters (:math:`\theta, r`) or the line in which :math:`(x_{0}, y_{0})`, :math:`(x_{1}, y_{1})` and :math:`(x_{2}, y_{2})` lay. 
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 15 KiB  | 
| 
		 Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 24 KiB  | 
| 
		 Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 5.4 KiB  | 
| 
		 Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 6.3 KiB  | 
| 
		 Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 7.8 KiB  | 
| 
		 Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 22 KiB  | 
| 
		 Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 23 KiB  | 
| 
		 Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 9.2 KiB  | 
| 
		 Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 7.3 KiB  | 
@@ -19,14 +19,12 @@ Theory
 | 
			
		||||
 | 
			
		||||
   .. image:: images/Laplace_Operator_Tutorial_Theory_Previous.jpg
 | 
			
		||||
           :alt: Previous theory
 | 
			
		||||
           :height: 200pt
 | 
			
		||||
           :align: center
 | 
			
		||||
 | 
			
		||||
#. And...what happens if we take the second derivative?
 | 
			
		||||
 | 
			
		||||
   .. image:: images/Laplace_Operator_Tutorial_Theory_ddIntensity.jpg
 | 
			
		||||
           :alt: Second derivative
 | 
			
		||||
           :height: 200pt
 | 
			
		||||
           :align: center
 | 
			
		||||
 | 
			
		||||
   You can observe that the second derivative is zero! So, we can also use this criterion to attempt to detect edges in an image. However, note that zeros will not only appear in edges (they can actually appear in other meaningless locations); this can be solved by applying filtering where needed.
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 19 KiB  | 
| 
		 Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 8.2 KiB  | 
| 
		 Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 20 KiB  | 
| 
		 Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 20 KiB  | 
| 
		 Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 20 KiB  | 
| 
		 Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 11 KiB  | 
| 
		 Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 5.5 KiB  | 
| 
		 Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 6.7 KiB  | 
| 
		 Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 7.4 KiB  | 
@@ -26,7 +26,6 @@ Theory
 | 
			
		||||
 | 
			
		||||
   .. image:: images/Sobel_Derivatives_Tutorial_Theory_0.jpg
 | 
			
		||||
           :alt: How intensity changes in an edge
 | 
			
		||||
           :height: 200pt
 | 
			
		||||
           :align: center
 | 
			
		||||
 
 | 
			
		||||
   You can easily notice that in an *edge*, the pixel intensity *changes* in a notorious way. A good way to express *changes* is by using *derivatives*. A high change in gradient indicates a major change in the image. 
 | 
			
		||||
@@ -35,14 +34,12 @@ Theory
 | 
			
		||||
 | 
			
		||||
   .. image:: images/Sobel_Derivatives_Tutorial_Theory_Intensity_Function.jpg
 | 
			
		||||
           :alt:  Intensity Plot for an edge
 | 
			
		||||
           :height: 200pt
 | 
			
		||||
           :align: center
 | 
			
		||||
 | 
			
		||||
#. The edge "jump" can be seen more easily if we take the first derivative (actually, here appears as a maximum)
 | 
			
		||||
 | 
			
		||||
   .. image:: images/Sobel_Derivatives_Tutorial_Theory_dIntensity_Function.jpg
 | 
			
		||||
           :alt:  First derivative of Intensity - Plot for an edge
 | 
			
		||||
           :height: 200pt
 | 
			
		||||
           :align: center
 | 
			
		||||
 | 
			
		||||
#. So, from the explanation above, we can deduce that a method to detect edges in an image can be performed by locating pixel locations where the gradient is higher than its neighbors (or to generalize, higher than a threshold).
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 15 KiB  | 
| 
		 Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 9.4 KiB  | 
| 
		 Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.1 KiB  | 
| 
		 Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 8.8 KiB  | 
| 
		 Before Width: | Height: | Size: 507 KiB After Width: | Height: | Size: 60 KiB  | 
| 
		 Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 18 KiB  | 
| 
		 Before Width: | Height: | Size: 43 KiB  | 
| 
		 After Width: | Height: | Size: 685 B  | 
| 
		 Before Width: | Height: | Size: 32 KiB  | 
| 
		 After Width: | Height: | Size: 558 B  | 
| 
		 Before Width: | Height: | Size: 58 KiB  | 
| 
		 After Width: | Height: | Size: 5.5 KiB  |