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!
@@ -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
|
||||
|
||||
|
||||