Skip to content

Commit

Permalink
fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
luigidr committed Jun 17, 2015
1 parent e15232c commit 9f3ed3f
Show file tree
Hide file tree
Showing 26 changed files with 51 additions and 29 deletions.
Binary file not shown.
Binary file modified docs/build/doctrees/04 - OpenCV Basics.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/05 - Camera Calibration.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/06 - Fourier Transform.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/07 - Image Segmentation.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/08 - Face Recognition and Tracking.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/doctrees/index.doctree
Binary file not shown.
3 changes: 1 addition & 2 deletions docs/build/html/02 - First Java Application with OpenCV.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ <h2>Create a simple application<a class="headerlink" href="#create-a-simple-appl
<p>Then we can define a new Mat.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The class <strong>Mat</strong> represents an n-dimensional dense numerical single-channel or multi-channel array. It can be used to store real or complex-valued vectors and matrices, grayscale or color images, voxel volumes, vector fields, point clouds, tensors, histograms.</p>
<p class="last">The class <strong>Mat</strong> represents an n-dimensional dense numerical single-channel or multi-channel array. It can be used to store real or complex-valued vectors and matrices, grayscale or color images, voxel volumes, vector fields, point clouds, tensors, histograms. For more details check out the OpenCV <a class="reference external" href="http://docs.opencv.org/modules/core/doc/basic_structures.html">page</a>.</p>
</div>
<p>For more details check out the OpenCV <a class="reference external" href="http://docs.opencv.org/modules/core/doc/basic_structures.html">page</a>.</p>
<div class="highlight-java"><div class="highlight"><pre><span class="n">Mat</span> <span class="n">mat</span> <span class="o">=</span> <span class="n">Mat</span><span class="o">.</span><span class="na">eye</span><span class="o">(</span><span class="mi">3</span><span class="o">,</span> <span class="mi">3</span><span class="o">,</span> <span class="n">CvType</span><span class="o">.</span><span class="na">CV_8UC1</span><span class="o">);</span>
</pre></div>
</div>
Expand Down
20 changes: 20 additions & 0 deletions docs/build/html/04 - OpenCV Basics.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,28 @@ <h2>Load an Image and Add it to the Stream<a class="headerlink" href="#load-an-i
</dd>
</dl>
<p>So we&#8217;ll have:</p>
<div class="highlight-java"><div class="highlight"><pre><span class="n">Core</span><span class="o">.</span><span class="na">addWeighted</span><span class="o">(</span><span class="n">imageROI</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">,</span> <span class="n">logo</span><span class="o">,</span> <span class="mf">0.7</span><span class="o">,</span> <span class="mf">0.0</span><span class="o">,</span> <span class="n">imageROI</span><span class="o">);</span>
</pre></div>
</div>
<p>The second method (<code class="docutils literal"><span class="pre">copyTo</span></code>) simply copies a Mat into the other. We&#8217;ll have:</p>
<div class="highlight-java"><div class="highlight"><pre><span class="n">Mat</span> <span class="n">mask</span> <span class="o">=</span> <span class="n">logo</span><span class="o">.</span><span class="na">clone</span><span class="o">();</span>
<span class="n">logo</span><span class="o">.</span><span class="na">copyTo</span><span class="o">(</span><span class="n">imageROI</span><span class="o">,</span> <span class="n">mask</span><span class="o">);</span>
</pre></div>
</div>
<p>Everything we have done so far to add the logo to the image has to perform only IF our checkbox is check and the image loading process has ended successfully. So we have to add an if condition:</p>
<div class="highlight-java"><div class="highlight"><pre><span class="k">if</span> <span class="o">(</span><span class="n">logoCheckBox</span><span class="o">.</span><span class="na">isSelected</span><span class="o">()</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="na">logo</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span>
<span class="o">{</span>
<span class="n">Rect</span> <span class="n">roi</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Rect</span><span class="o">(</span><span class="n">frame</span><span class="o">.</span><span class="na">cols</span><span class="o">()</span> <span class="o">-</span> <span class="n">logo</span><span class="o">.</span><span class="na">cols</span><span class="o">(),</span> <span class="n">frame</span><span class="o">.</span><span class="na">rows</span><span class="o">()</span> <span class="o">-</span> <span class="n">logo</span><span class="o">.</span><span class="na">rows</span><span class="o">(),</span> <span class="n">logo</span><span class="o">.</span><span class="na">cols</span><span class="o">(),</span><span class="n">logo</span><span class="o">.</span><span class="na">rows</span><span class="o">());</span>
<span class="n">Mat</span> <span class="n">imageROI</span> <span class="o">=</span> <span class="n">frame</span><span class="o">.</span><span class="na">submat</span><span class="o">(</span><span class="n">roi</span><span class="o">);</span>
<span class="c1">// add the logo: method #1</span>

<span class="n">Core</span><span class="o">.</span><span class="na">addWeighted</span><span class="o">(</span><span class="n">imageROI</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">,</span> <span class="n">logo</span><span class="o">,</span> <span class="mf">0.7</span><span class="o">,</span> <span class="mf">0.0</span><span class="o">,</span> <span class="n">imageROI</span><span class="o">);</span>
<span class="c1">// add the logo: method #2</span>
<span class="c1">// Mat mask = logo.clone();</span>
<span class="c1">// logo.copyTo(imageROI, mask);</span>
<span class="o">}</span>
</pre></div>
</div>
</div>
<div class="section" id="calculate-a-histogram">
<h2>Calculate a Histogram<a class="headerlink" href="#calculate-a-histogram" title="Permalink to this headline"></a></h2>
Expand Down
3 changes: 1 addition & 2 deletions docs/build/html/05 - Camera Calibration.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ <h2>Getting Started<a class="headerlink" href="#getting-started" title="Permalin
<p>Create a new JavaFX project (e.g. &#8220;CameraCalibration&#8221;) with the usual OpenCV user library.
Open Scene Builder and add a Border Pane with:</p>
<ul class="simple">
<li>on <strong>TOP</strong> we need to have the possibility to set the number of samples for the calibration, the number of horizontal corners we have in the test image, the number of vertical corners we have in the test image and a button to update this data.</li>
<li>on <strong>TOP</strong> we need to have the possibility to set the number of samples for the calibration, the number of horizontal corners we have in the test image, the number of vertical corners we have in the test image and a button to update this data. To make things cleaner let&#8217;s put all these elements inside a HBox.</li>
</ul>
<p>To make things cleaner let&#8217;s put all these elements inside a HBox.</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;HBox</span> <span class="na">alignment=</span><span class="s">&quot;CENTER&quot;</span> <span class="na">spacing=</span><span class="s">&quot;10&quot;</span><span class="nt">&gt;</span>
</pre></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/html/06 - Fourier Transform.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ <h2>Source Code<a class="headerlink" href="#source-code" title="Permalink to thi

<span class="n">launch</span><span class="o">(</span><span class="n">args</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
</pre></div>
</div>
<p>}</p>
<ul class="simple">
<li><a class="reference external" href="https://github.com/java-opencv/Polito-Java-OpenCV-Tutorials-Source-Code/blob/master/Fourier%20Transform/src/application/FT_Controller.java">FT_Controller.java</a></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/html/07 - Image Segmentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ <h2>Using the Canny edge detection<a class="headerlink" href="#using-the-canny-e
<li><code class="docutils literal"><span class="pre">detectedEdges</span></code>: Source image, grayscale</li>
<li><code class="docutils literal"><span class="pre">detectedEdges</span></code>: Output of the detector (can be the same as the input)</li>
<li><code class="docutils literal"><span class="pre">this.threshold.getValue()</span></code>: The value entered by the user moving the Slider</li>
<li><code class="docutils literal"><span class="pre">this.threshold.getValue()</span> <span class="pre">*</span> <span class="pre">3</span></code>: Set in the program as three times the lower threshold (following Canny?s recommendation)</li>
<li><code class="docutils literal"><span class="pre">this.threshold.getValue()</span> <span class="pre">*</span> <span class="pre">3</span></code>: Set in the program as three times the lower threshold (following Canny&#8217;s recommendation)</li>
<li><code class="docutils literal"><span class="pre">3</span></code>: The size of the Sobel kernel to be used internally</li>
<li><code class="docutils literal"><span class="pre">false</span></code>: a flag, indicating whether to use a more accurate calculation of the magnitude gradient.</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/html/08 - Face Recognition and Tracking.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ <h2>Detection and Tracking<a class="headerlink" href="#detection-and-tracking" t
<div class="highlight-java"><div class="highlight"><pre><span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="na">absoluteFaceSize</span> <span class="o">==</span> <span class="mi">0</span><span class="o">)</span>
<span class="o">{</span>
<span class="kt">int</span> <span class="n">height</span> <span class="o">=</span> <span class="n">grayFrame</span><span class="o">.</span><span class="na">rows</span><span class="o">();</span>
<span class="k">if</span> <span class="o">(</span><span class="n">Math</span><span class="o">.</span><span class="na">round</span><span class="o">(</span><span class="n">height</span> <span class="o">*</span> <span class="mf">0.2f</span><span class="o">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="o">)?</span>
<span class="k">if</span> <span class="o">(</span><span class="n">Math</span><span class="o">.</span><span class="na">round</span><span class="o">(</span><span class="n">height</span> <span class="o">*</span> <span class="mf">0.2f</span><span class="o">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="o">)</span>
<span class="o">{</span>
<span class="k">this</span><span class="o">.</span><span class="na">absoluteFaceSize</span> <span class="o">=</span> <span class="n">Math</span><span class="o">.</span><span class="na">round</span><span class="o">(</span><span class="n">height</span> <span class="o">*</span> <span class="mf">0.2f</span><span class="o">);</span>
<span class="o">}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ First of all we need to load the Native Library previously set on our project.

Then we can define a new Mat.

.. note:: The class **Mat** represents an n-dimensional dense numerical single-channel or multi-channel array. It can be used to store real or complex-valued vectors and matrices, grayscale or color images, voxel volumes, vector fields, point clouds, tensors, histograms.
For more details check out the OpenCV `page <http://docs.opencv.org/modules/core/doc/basic_structures.html>`_.
.. note:: The class **Mat** represents an n-dimensional dense numerical single-channel or multi-channel array. It can be used to store real or complex-valued vectors and matrices, grayscale or color images, voxel volumes, vector fields, point clouds, tensors, histograms. For more details check out the OpenCV `page <http://docs.opencv.org/modules/core/doc/basic_structures.html>`_.

.. code-block:: java

Expand Down
10 changes: 6 additions & 4 deletions docs/build/html/_sources/04 - OpenCV Basics.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Adapt the code.
We are going to add some variants to the code in order to display our logo in a specific region of the stream. This means that for each frame capture, before the image could be converted into 1 or 3 channels, we have to set a **ROI** (region of interest) in which we want to place the logo.
Usually a ROI of an Image is a portion of it, we can define the roi as a Rect object.
Rect is a template class for 2D rectangles, described by the following parameters:

* Coordinates of the top-left corner. This is a default interpretation of Rect.x and Rect.y in OpenCV. Though, in your algorithms you may count x and y from the bottom-left corner.
* Rectangle width and height.

Expand Down Expand Up @@ -148,20 +149,20 @@ Parameters:

So we'll have:

.. block-code:: java
.. code-block:: java

Core.addWeighted(imageROI, 1.0, logo, 0.7, 0.0, imageROI);

The second method (``copyTo``) simply copies a Mat into the other. We'll have:

.. block-code:: java
.. code-block:: java

Mat mask = logo.clone();
logo.copyTo(imageROI, mask);

Everything we have done so far to add the logo to the image has to perform only IF our checkbox is check and the image loading process has ended successfully. So we have to add an if condition:

.. block-code:: java
.. code-block:: java

if (logoCheckBox.isSelected() && this.logo != null)
{
Expand Down Expand Up @@ -202,7 +203,8 @@ First thing we need to do is to divide the frame into other *n* frames, where *n

Before we could calculate the histogram of each channel we have to prepare all the inputs that the ``calcHist`` function needs.
The functions calcHist calculate the histogram of one or more arrays. The elements of a tuple used to increment a histogram bin are taken from the corresponding input arrays at the same location.
Parameters:
Parameters:

- **images** Source arrays. They all should have the same depth, CV_8U or CV_32F, and the same size. Each of them can have an arbitrary number of channels.
- **channels** List of the dims channels used to compute the histogram. The first array channels are numerated from 0 to images[0].channels()-1, the second array channels are counted from images[0].channels() to images[0].channels() + images[1].channels()-1, and so on.
- **mask** Optional mask. If the matrix is not empty, it must be an 8-bit array of the same size as images[i]. The non-zero mask elements mark the array elements counted in the histogram.
Expand Down
3 changes: 1 addition & 2 deletions docs/build/html/_sources/05 - Camera Calibration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ Getting Started
Create a new JavaFX project (e.g. "CameraCalibration") with the usual OpenCV user library.
Open Scene Builder and add a Border Pane with:

- on **TOP** we need to have the possibility to set the number of samples for the calibration, the number of horizontal corners we have in the test image, the number of vertical corners we have in the test image and a button to update this data.
To make things cleaner let's put all these elements inside a HBox.
- on **TOP** we need to have the possibility to set the number of samples for the calibration, the number of horizontal corners we have in the test image, the number of vertical corners we have in the test image and a button to update this data. To make things cleaner let's put all these elements inside a HBox.

.. code-block:: xml

Expand Down
2 changes: 1 addition & 1 deletion docs/build/html/_sources/06 - Fourier Transform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ Source Code

launch(args);
}
}
}

- `FT_Controller.java <https://github.com/java-opencv/Polito-Java-OpenCV-Tutorials-Source-Code/blob/master/Fourier%20Transform/src/application/FT_Controller.java>`_

Expand Down
3 changes: 2 additions & 1 deletion docs/build/html/_sources/07 - Image Segmentation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Getting Started
Let's create a new JavaFX project. In Scene Builder set the windows element so that we have a Border Pane with:

- on **TOP** a VBox containing two HBox, each one followed by a separator.

+ In the first HBox we are goning to need a checkbox and a *slider*, the first one is to select the Canny e.d. mode and the second one is going to be used to control the value of the threshold to be passed to the Canny e.d. function.

.. code-block:: xml
Expand Down Expand Up @@ -104,7 +105,7 @@ where the arguments are:
- ``detectedEdges``: Source image, grayscale
- ``detectedEdges``: Output of the detector (can be the same as the input)
- ``this.threshold.getValue()``: The value entered by the user moving the Slider
- ``this.threshold.getValue() * 3``: Set in the program as three times the lower threshold (following Cannys recommendation)
- ``this.threshold.getValue() * 3``: Set in the program as three times the lower threshold (following Canny's recommendation)
- ``3``: The size of the Sobel kernel to be used internally
- ``false``: a flag, indicating whether to use a more accurate calculation of the magnitude gradient.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Then we have to set the minimum size of the face to be detected (this required i
if (this.absoluteFaceSize == 0)
{
int height = grayFrame.rows();
if (Math.round(height * 0.2f) > 0)
if (Math.round(height * 0.2f) > 0)
{
this.absoluteFaceSize = Math.round(height * 0.2f);
}
Expand All @@ -109,6 +109,7 @@ Now we can start the detection:

The ``detectMultiScale`` function detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.
The parameters are:

- **image** Matrix of the type CV_8U containing an image where objects are detected.
- **objects** Vector of rectangles where each rectangle contains the detected object.
- **scaleFactor** Parameter specifying how much the image size is reduced at each image scale.
Expand Down
3 changes: 1 addition & 2 deletions docs/source/02 - First Java Application with OpenCV.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ First of all we need to load the Native Library previously set on our project.
Then we can define a new Mat.

.. note:: The class **Mat** represents an n-dimensional dense numerical single-channel or multi-channel array. It can be used to store real or complex-valued vectors and matrices, grayscale or color images, voxel volumes, vector fields, point clouds, tensors, histograms.
For more details check out the OpenCV `page <http://docs.opencv.org/modules/core/doc/basic_structures.html>`_.
.. note:: The class **Mat** represents an n-dimensional dense numerical single-channel or multi-channel array. It can be used to store real or complex-valued vectors and matrices, grayscale or color images, voxel volumes, vector fields, point clouds, tensors, histograms. For more details check out the OpenCV `page <http://docs.opencv.org/modules/core/doc/basic_structures.html>`_.

.. code-block:: java
Expand Down
10 changes: 6 additions & 4 deletions docs/source/04 - OpenCV Basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Adapt the code.
We are going to add some variants to the code in order to display our logo in a specific region of the stream. This means that for each frame capture, before the image could be converted into 1 or 3 channels, we have to set a **ROI** (region of interest) in which we want to place the logo.
Usually a ROI of an Image is a portion of it, we can define the roi as a Rect object.
Rect is a template class for 2D rectangles, described by the following parameters:

* Coordinates of the top-left corner. This is a default interpretation of Rect.x and Rect.y in OpenCV. Though, in your algorithms you may count x and y from the bottom-left corner.
* Rectangle width and height.

Expand Down Expand Up @@ -148,20 +149,20 @@ Parameters:

So we'll have:

.. block-code:: java
.. code-block:: java
Core.addWeighted(imageROI, 1.0, logo, 0.7, 0.0, imageROI);
The second method (``copyTo``) simply copies a Mat into the other. We'll have:

.. block-code:: java
.. code-block:: java
Mat mask = logo.clone();
logo.copyTo(imageROI, mask);
Everything we have done so far to add the logo to the image has to perform only IF our checkbox is check and the image loading process has ended successfully. So we have to add an if condition:

.. block-code:: java
.. code-block:: java
if (logoCheckBox.isSelected() && this.logo != null)
{
Expand Down Expand Up @@ -202,7 +203,8 @@ First thing we need to do is to divide the frame into other *n* frames, where *n
Before we could calculate the histogram of each channel we have to prepare all the inputs that the ``calcHist`` function needs.
The functions calcHist calculate the histogram of one or more arrays. The elements of a tuple used to increment a histogram bin are taken from the corresponding input arrays at the same location.
Parameters:
Parameters:

- **images** Source arrays. They all should have the same depth, CV_8U or CV_32F, and the same size. Each of them can have an arbitrary number of channels.
- **channels** List of the dims channels used to compute the histogram. The first array channels are numerated from 0 to images[0].channels()-1, the second array channels are counted from images[0].channels() to images[0].channels() + images[1].channels()-1, and so on.
- **mask** Optional mask. If the matrix is not empty, it must be an 8-bit array of the same size as images[i]. The non-zero mask elements mark the array elements counted in the histogram.
Expand Down

0 comments on commit 9f3ed3f

Please sign in to comment.