Parcourir la source

Add of area under curves computations

Jérôme BUISINE il y a 5 ans
Parent
commit
2020d7397e
38 fichiers modifiés avec 276 ajouts et 90 suppressions
  1. 1 1
      README.rst
  2. 5 0
      build.sh
  3. BIN
      docs/build/doctrees/environment.pickle
  4. BIN
      docs/build/doctrees/ipfml/ipfml.processing.doctree
  5. BIN
      docs/build/doctrees/ipfml/ipfml.utils.doctree
  6. 1 1
      docs/build/html/.buildinfo
  7. 2 2
      docs/build/html/_modules/index.html
  8. 2 2
      docs/build/html/_modules/ipfml/exceptions.html
  9. 2 2
      docs/build/html/_modules/ipfml/filters/noise.html
  10. 2 2
      docs/build/html/_modules/ipfml/iqa/fr.html
  11. 2 2
      docs/build/html/_modules/ipfml/metrics.html
  12. 7 10
      docs/build/html/_modules/ipfml/processing.html
  13. 54 6
      docs/build/html/_modules/ipfml/utils.html
  14. 2 0
      docs/build/html/_sources/ipfml/ipfml.processing.rst.txt
  15. 2 0
      docs/build/html/_sources/ipfml/ipfml.utils.rst.txt
  16. 1 1
      docs/build/html/_static/documentation_options.js
  17. 2 2
      docs/build/html/contributing.html
  18. 2 2
      docs/build/html/description.html
  19. 2 2
      docs/build/html/examples.html
  20. 8 4
      docs/build/html/genindex.html
  21. 2 2
      docs/build/html/index.html
  22. 2 2
      docs/build/html/ipfml.html
  23. 2 2
      docs/build/html/ipfml/ipfml.exceptions.html
  24. 2 2
      docs/build/html/ipfml/ipfml.filters.noise.html
  25. 2 2
      docs/build/html/ipfml/ipfml.iqa.fr.html
  26. 2 2
      docs/build/html/ipfml/ipfml.metrics.html
  27. 20 13
      docs/build/html/ipfml/ipfml.processing.html
  28. 70 4
      docs/build/html/ipfml/ipfml.utils.html
  29. BIN
      docs/build/html/objects.inv
  30. 2 2
      docs/build/html/py-modindex.html
  31. 2 2
      docs/build/html/search.html
  32. 1 1
      docs/build/html/searchindex.js
  33. 4 3
      docs/source/conf.py
  34. 2 0
      docs/source/ipfml/ipfml.processing.rst
  35. 2 0
      docs/source/ipfml/ipfml.utils.rst
  36. 8 7
      ipfml/processing.py
  37. 52 4
      ipfml/utils.py
  38. 4 3
      setup.py

+ 1 - 1
README.rst

@@ -8,7 +8,7 @@ Installation
 
 .. code:: bash
 
-   pip install ifpml
+   pip install ipfml
 
 How to use ?
 ------------

+ 5 - 0
build.sh

@@ -1,4 +1,9 @@
 #! bin/bash
 
 # script used to build documentation from setup.py build command
+echo "Build package..."
+python setup.py build
+
+echo "Build documentation..."
+rm -r docs/source/ipfml
 cd docs && make clean && make html

BIN
docs/build/doctrees/environment.pickle


BIN
docs/build/doctrees/ipfml/ipfml.processing.doctree


BIN
docs/build/doctrees/ipfml/ipfml.utils.doctree


+ 1 - 1
docs/build/html/.buildinfo

@@ -1,4 +1,4 @@
 # Sphinx build info version 1
 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: 2ba2dcd178d8c98ffdade52250f9b9e5
+config: 3cbbb77c1c509196319f8e965a17ca1b
 tags: 645f666f9bcd5a90fca523b33c5a78b7

+ 2 - 2
docs/build/html/_modules/index.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Overview: module code &mdash; IPFML v0.3.1 documentation</title>
+  <title>Overview: module code &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -56,7 +56,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/ipfml/exceptions.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>ipfml.exceptions &mdash; IPFML v0.3.1 documentation</title>
+  <title>ipfml.exceptions &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -56,7 +56,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/ipfml/filters/noise.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>ipfml.filters.noise &mdash; IPFML v0.3.1 documentation</title>
+  <title>ipfml.filters.noise &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -56,7 +56,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/ipfml/iqa/fr.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>ipfml.iqa.fr &mdash; IPFML v0.3.1 documentation</title>
+  <title>ipfml.iqa.fr &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -56,7 +56,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/_modules/ipfml/metrics.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>ipfml.metrics &mdash; IPFML v0.3.1 documentation</title>
+  <title>ipfml.metrics &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -56,7 +56,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 7 - 10
docs/build/html/_modules/ipfml/processing.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>ipfml.processing &mdash; IPFML v0.3.1 documentation</title>
+  <title>ipfml.processing &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -56,7 +56,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           
@@ -528,7 +528,7 @@
 
 
 <div class="viewcode-block" id="rotate_image"><a class="viewcode-back" href="../../ipfml/ipfml.processing.html#ipfml.processing.rotate_image">[docs]</a><span class="k">def</span> <span class="nf">rotate_image</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="n">angle</span><span class="o">=</span><span class="mi">90</span><span class="p">,</span> <span class="n">pil</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
-    <span class="sd">&#39;&#39;&#39;Rotate image using specific angle</span>
+    <span class="sd">&quot;&quot;&quot;Rotate image using specific angle</span>
 
 <span class="sd">    Args:</span>
 <span class="sd">        image: PIL Image or Numpy array</span>
@@ -540,23 +540,20 @@
 
 <span class="sd">    Example:</span>
 
+<span class="sd">    &gt;&gt;&gt; from PIL import Image</span>
 <span class="sd">    &gt;&gt;&gt; import numpy as np</span>
 <span class="sd">    &gt;&gt;&gt; from ipfml import processing</span>
-<span class="sd">    &gt;&gt;&gt; image_values = np.random.randint(255, size=(800, 800, 3))</span>
+<span class="sd">    &gt;&gt;&gt; image_values = Image.open(&#39;./images/test_img.png&#39;)</span>
 <span class="sd">    &gt;&gt;&gt; rotated_image = processing.rotate_image(image_values, 90, pil=False)</span>
 <span class="sd">    &gt;&gt;&gt; rotated_image.shape</span>
-<span class="sd">    (800, 800, 3)</span>
-<span class="sd">    &#39;&#39;&#39;</span>
+<span class="sd">    (200, 200, 3)</span>
+<span class="sd">    &quot;&quot;&quot;</span>
 
     <span class="n">mode</span> <span class="o">=</span> <span class="s1">&#39;RGB&#39;</span>
     <span class="n">image_array</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">image</span><span class="p">)</span>
 
-    <span class="c1"># convert image in numpy array (perhaps not necessary)</span>
     <span class="k">if</span> <span class="n">image_array</span><span class="o">.</span><span class="n">ndim</span> <span class="o">!=</span> <span class="mi">3</span><span class="p">:</span>
         <span class="n">mode</span> <span class="o">=</span> <span class="s1">&#39;L&#39;</span>
-        <span class="n">width</span><span class="p">,</span> <span class="n">height</span> <span class="o">=</span> <span class="n">image_array</span><span class="o">.</span><span class="n">shape</span>
-    <span class="k">else</span><span class="p">:</span>
-        <span class="n">width</span><span class="p">,</span> <span class="n">height</span><span class="p">,</span> <span class="n">dim</span> <span class="o">=</span> <span class="n">image_array</span><span class="o">.</span><span class="n">shape</span>
 
     <span class="n">rotated_image</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span>
         <span class="n">transform</span><span class="o">.</span><span class="n">rotate</span><span class="p">(</span><span class="n">image_array</span><span class="p">,</span> <span class="n">angle</span><span class="p">)</span> <span class="o">*</span> <span class="mi">255</span><span class="p">,</span> <span class="s1">&#39;uint8&#39;</span><span class="p">)</span>

+ 54 - 6
docs/build/html/_modules/ipfml/utils.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>ipfml.utils &mdash; IPFML v0.3.1 documentation</title>
+  <title>ipfml.utils &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -56,7 +56,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           
@@ -155,9 +155,11 @@
 
 <span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
 
+<span class="kn">from</span> <span class="nn">scipy.integrate</span> <span class="k">import</span> <span class="n">simps</span>
+
 
 <div class="viewcode-block" id="normalize_arr"><a class="viewcode-back" href="../../ipfml/ipfml.utils.html#ipfml.utils.normalize_arr">[docs]</a><span class="k">def</span> <span class="nf">normalize_arr</span><span class="p">(</span><span class="n">arr</span><span class="p">):</span>
-    <span class="sd">&#39;&#39;&#39;Normalize data of 1D array shape</span>
+    <span class="sd">&quot;&quot;&quot;Normalize data of 1D array shape</span>
 
 <span class="sd">    Args:</span>
 <span class="sd">        arr: array data of 1D shape</span>
@@ -173,7 +175,7 @@
 <span class="sd">    &gt;&gt;&gt; arr_normalized = utils.normalize_arr(arr)</span>
 <span class="sd">    &gt;&gt;&gt; arr_normalized[1]</span>
 <span class="sd">    0.1</span>
-<span class="sd">    &#39;&#39;&#39;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
 
     <span class="n">output_arr</span> <span class="o">=</span> <span class="p">[]</span>
     <span class="n">max_value</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">arr</span><span class="p">)</span>
@@ -196,10 +198,10 @@
 
 <span class="sd">    Example:</span>
 
-<span class="sd">    &gt;&gt;&gt; from ipfml import processing</span>
+<span class="sd">    &gt;&gt;&gt; from ipfml import utils</span>
 <span class="sd">    &gt;&gt;&gt; import numpy as np</span>
 <span class="sd">    &gt;&gt;&gt; arr = np.arange(11)</span>
-<span class="sd">    &gt;&gt;&gt; arr_normalized = processing.normalize_arr_with_range(arr, 0, 20)</span>
+<span class="sd">    &gt;&gt;&gt; arr_normalized = utils.normalize_arr_with_range(arr, 0, 20)</span>
 <span class="sd">    &gt;&gt;&gt; arr_normalized[1]</span>
 <span class="sd">    0.05</span>
 <span class="sd">    &#39;&#39;&#39;</span>
@@ -246,6 +248,52 @@
             <span class="n">normalize_arr_with_range</span><span class="p">(</span><span class="n">values</span><span class="p">,</span> <span class="n">min_value</span><span class="p">,</span> <span class="n">max_value</span><span class="p">))</span>
 
     <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">asarray</span><span class="p">(</span><span class="n">output_array</span><span class="p">)</span></div>
+
+
+<div class="viewcode-block" id="integral_area_trapz"><a class="viewcode-back" href="../../ipfml/ipfml.utils.html#ipfml.utils.integral_area_trapz">[docs]</a><span class="k">def</span> <span class="nf">integral_area_trapz</span><span class="p">(</span><span class="n">y_values</span><span class="p">,</span> <span class="n">dx</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;Returns area under curves from provided data points using Trapezium rule</span>
+
+<span class="sd">    Args:</span>
+<span class="sd">        points: array of point coordinates</span>
+<span class="sd">        dx: number of unit for x axis</span>
+
+<span class="sd">    Returns:</span>
+<span class="sd">        Area under curves obtained from these points</span>
+
+<span class="sd">    Example:</span>
+
+<span class="sd">    &gt;&gt;&gt; from ipfml import utils</span>
+<span class="sd">    &gt;&gt;&gt; import numpy as np</span>
+<span class="sd">    &gt;&gt;&gt; y_values = np.array([5, 20, 4, 18, 19, 18, 7, 4])</span>
+<span class="sd">    &gt;&gt;&gt; area = utils.integral_area_trapz(y_values, dx=5)</span>
+<span class="sd">    &gt;&gt;&gt; area</span>
+<span class="sd">    452.5</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+
+    <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">trapz</span><span class="p">(</span><span class="n">y_values</span><span class="p">,</span> <span class="n">dx</span><span class="o">=</span><span class="n">dx</span><span class="p">)</span></div>
+
+
+<div class="viewcode-block" id="integral_area_simps"><a class="viewcode-back" href="../../ipfml/ipfml.utils.html#ipfml.utils.integral_area_simps">[docs]</a><span class="k">def</span> <span class="nf">integral_area_simps</span><span class="p">(</span><span class="n">y_values</span><span class="p">,</span> <span class="n">dx</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;Returns area under curves from provided data points using Simpsons rule</span>
+
+<span class="sd">    Args:</span>
+<span class="sd">        points: array of point coordinates</span>
+<span class="sd">        dx: number of unit for x axis</span>
+
+<span class="sd">    Returns:</span>
+<span class="sd">        Area under curves obtained from these points</span>
+
+<span class="sd">    Example:</span>
+
+<span class="sd">    &gt;&gt;&gt; from ipfml import utils</span>
+<span class="sd">    &gt;&gt;&gt; import numpy as np</span>
+<span class="sd">    &gt;&gt;&gt; y_values = np.array([5, 20, 4, 18, 19, 18, 7, 4])</span>
+<span class="sd">    &gt;&gt;&gt; area = utils.integral_area_simps(y_values, dx=5)</span>
+<span class="sd">    &gt;&gt;&gt; area</span>
+<span class="sd">    460.0</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+
+    <span class="k">return</span> <span class="n">simps</span><span class="p">(</span><span class="n">y_values</span><span class="p">,</span> <span class="n">dx</span><span class="o">=</span><span class="n">dx</span><span class="p">)</span></div>
 </pre></div>
 
            </div>

+ 2 - 0
docs/build/html/_sources/ipfml/ipfml.processing.rst.txt

@@ -10,6 +10,7 @@ ipfml.processing
    .. autosummary::
    
       divide_in_blocks
+      fusion_images
       get_LAB_L_SVD
       get_LAB_L_SVD_U
       get_LAB_L_SVD_V
@@ -18,6 +19,7 @@ ipfml.processing
       rgb_to_LAB_L_low_bits
       rgb_to_grey_low_bits
       rgb_to_mscn
+      rotate_image
    
    
 

+ 2 - 0
docs/build/html/_sources/ipfml/ipfml.utils.rst.txt

@@ -9,6 +9,8 @@ ipfml.utils
 
    .. autosummary::
    
+      integral_area_simps
+      integral_area_trapz
       normalize_2D_arr
       normalize_arr
       normalize_arr_with_range

+ 1 - 1
docs/build/html/_static/documentation_options.js

@@ -1,6 +1,6 @@
 var DOCUMENTATION_OPTIONS = {
     URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
-    VERSION: 'v0.3.1',
+    VERSION: 'v0.3.2',
     LANGUAGE: 'None',
     COLLAPSE_INDEX: false,
     FILE_SUFFIX: '.html',

+ 2 - 2
docs/build/html/contributing.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Contributing &mdash; IPFML v0.3.1 documentation</title>
+  <title>Contributing &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -57,7 +57,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/description.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Description &mdash; IPFML v0.3.1 documentation</title>
+  <title>Description &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/examples.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Examples &mdash; IPFML v0.3.1 documentation</title>
+  <title>Examples &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 8 - 4
docs/build/html/genindex.html

@@ -9,7 +9,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Index &mdash; IPFML v0.3.1 documentation</title>
+  <title>Index &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -57,7 +57,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           
@@ -247,14 +247,18 @@
 <h2 id="I">I</h2>
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%; vertical-align: top;"><ul>
+      <li><a href="ipfml/ipfml.utils.html#ipfml.utils.integral_area_simps">integral_area_simps() (in module ipfml.utils)</a>
+</li>
+      <li><a href="ipfml/ipfml.utils.html#ipfml.utils.integral_area_trapz">integral_area_trapz() (in module ipfml.utils)</a>
+</li>
       <li><a href="ipfml/ipfml.exceptions.html#module-ipfml.exceptions">ipfml.exceptions (module)</a>
 </li>
       <li><a href="ipfml/ipfml.filters.noise.html#module-ipfml.filters.noise">ipfml.filters.noise (module)</a>
-</li>
-      <li><a href="ipfml/ipfml.iqa.fr.html#module-ipfml.iqa.fr">ipfml.iqa.fr (module)</a>
 </li>
   </ul></td>
   <td style="width: 33%; vertical-align: top;"><ul>
+      <li><a href="ipfml/ipfml.iqa.fr.html#module-ipfml.iqa.fr">ipfml.iqa.fr (module)</a>
+</li>
       <li><a href="ipfml/ipfml.metrics.html#module-ipfml.metrics">ipfml.metrics (module)</a>
 </li>
       <li><a href="ipfml/ipfml.processing.html#module-ipfml.processing">ipfml.processing (module)</a>

+ 2 - 2
docs/build/html/index.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Image Processing For Machine Learning &mdash; IPFML v0.3.1 documentation</title>
+  <title>Image Processing For Machine Learning &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -57,7 +57,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/ipfml.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Documentation &mdash; IPFML v0.3.1 documentation</title>
+  <title>Documentation &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/ipfml/ipfml.exceptions.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>ipfml.exceptions &mdash; IPFML v0.3.1 documentation</title>
+  <title>ipfml.exceptions &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/ipfml/ipfml.filters.noise.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>ipfml.filters.noise &mdash; IPFML v0.3.1 documentation</title>
+  <title>ipfml.filters.noise &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/ipfml/ipfml.iqa.fr.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>ipfml.iqa.fr &mdash; IPFML v0.3.1 documentation</title>
+  <title>ipfml.iqa.fr &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/ipfml/ipfml.metrics.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>ipfml.metrics &mdash; IPFML v0.3.1 documentation</title>
+  <title>ipfml.metrics &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -58,7 +58,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

Fichier diff supprimé car celui-ci est trop grand
+ 20 - 13
docs/build/html/ipfml/ipfml.processing.html


Fichier diff supprimé car celui-ci est trop grand
+ 70 - 4
docs/build/html/ipfml/ipfml.utils.html


BIN
docs/build/html/objects.inv


+ 2 - 2
docs/build/html/py-modindex.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Python Module Index &mdash; IPFML v0.3.1 documentation</title>
+  <title>Python Module Index &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -59,7 +59,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

+ 2 - 2
docs/build/html/search.html

@@ -8,7 +8,7 @@
   
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   
-  <title>Search &mdash; IPFML v0.3.1 documentation</title>
+  <title>Search &mdash; IPFML v0.3.2 documentation</title>
   
 
   
@@ -56,7 +56,7 @@
             
             
               <div class="version">
-                0.3.1
+                0.3.2
               </div>
             
           

Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
docs/build/html/searchindex.js


+ 4 - 3
docs/source/conf.py

@@ -24,9 +24,9 @@ copyright = '2019, Jérôme BUISINE'
 author = 'Jérôme BUISINE'
 
 # The short X.Y version
-version = '0.3.1'
+version = '0.3.2'
 # The full versiabson, including alpha/beta/rc tags
-release = 'v0.3.1'
+release = 'v0.3.2'
 
 
 # -- General configuration ---------------------------------------------------
@@ -48,8 +48,9 @@ extensions = [
     'sphinx.ext.coverage'
 ]
 
-autodoc_default_flags = ['members']
 autosummary_generate = True
+autodoc_default_flags = ['members']
+autodoc_member_order = 'groupwise'
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']

+ 2 - 0
docs/source/ipfml/ipfml.processing.rst

@@ -10,6 +10,7 @@ ipfml.processing
    .. autosummary::
    
       divide_in_blocks
+      fusion_images
       get_LAB_L_SVD
       get_LAB_L_SVD_U
       get_LAB_L_SVD_V
@@ -18,6 +19,7 @@ ipfml.processing
       rgb_to_LAB_L_low_bits
       rgb_to_grey_low_bits
       rgb_to_mscn
+      rotate_image
    
    
 

+ 2 - 0
docs/source/ipfml/ipfml.utils.rst

@@ -9,6 +9,8 @@ ipfml.utils
 
    .. autosummary::
    
+      integral_area_simps
+      integral_area_trapz
       normalize_2D_arr
       normalize_arr
       normalize_arr_with_range

+ 8 - 7
ipfml/processing.py

@@ -319,7 +319,7 @@ def fusion_images(images, pil=True):
     '''
 
     mode = 'RGB'
-    dim  = 1
+    dim = 1
 
     if len(images) == 0:
         raise ValueError('Empty array of images provided...')
@@ -377,7 +377,7 @@ def fusion_images(images, pil=True):
 
 
 def rotate_image(image, angle=90, pil=True):
-    '''Rotate image using specific angle
+    """Rotate image using specific angle
 
     Args:
         image: PIL Image or Numpy array
@@ -389,13 +389,14 @@ def rotate_image(image, angle=90, pil=True):
 
     Example:
 
+    >>> from PIL import Image
     >>> import numpy as np
     >>> from ipfml import processing
-    >>> image_values = np.random.randint(255, size=(800, 800, 3))
+    >>> image_values = Image.open('./images/test_img.png')
     >>> rotated_image = processing.rotate_image(image_values, 90, pil=False)
     >>> rotated_image.shape
-    (800, 800, 3)
-    '''
+    (200, 200, 3)
+    """
 
     mode = 'RGB'
     image_array = np.asarray(image)
@@ -403,10 +404,10 @@ def rotate_image(image, angle=90, pil=True):
     if image_array.ndim != 3:
         mode = 'L'
 
-    rotated_image = np.array(transform.rotate(image_array, angle)*255, 'uint8')
+    rotated_image = np.array(
+        transform.rotate(image_array, angle) * 255, 'uint8')
 
     if pil:
         return Image.fromarray(rotated_image, mode)
     else:
         return rotated_image
-

+ 52 - 4
ipfml/utils.py

@@ -4,9 +4,11 @@ Utils functions of ipfml package (array normalization)
 
 import numpy as np
 
+from scipy.integrate import simps
+
 
 def normalize_arr(arr):
-    '''Normalize data of 1D array shape
+    """Normalize data of 1D array shape
 
     Args:
         arr: array data of 1D shape
@@ -22,7 +24,7 @@ def normalize_arr(arr):
     >>> arr_normalized = utils.normalize_arr(arr)
     >>> arr_normalized[1]
     0.1
-    '''
+    """
 
     output_arr = []
     max_value = max(arr)
@@ -45,10 +47,10 @@ def normalize_arr_with_range(arr, min, max):
 
     Example:
 
-    >>> from ipfml import processing
+    >>> from ipfml import utils
     >>> import numpy as np
     >>> arr = np.arange(11)
-    >>> arr_normalized = processing.normalize_arr_with_range(arr, 0, 20)
+    >>> arr_normalized = utils.normalize_arr_with_range(arr, 0, 20)
     >>> arr_normalized[1]
     0.05
     '''
@@ -95,3 +97,49 @@ def normalize_2D_arr(arr):
             normalize_arr_with_range(values, min_value, max_value))
 
     return np.asarray(output_array)
+
+
+def integral_area_trapz(y_values, dx):
+    """Returns area under curves from provided data points using Trapezium rule
+
+    Args:
+        points: array of point coordinates
+        dx: number of unit for x axis
+
+    Returns:
+        Area under curves obtained from these points
+
+    Example:
+
+    >>> from ipfml import utils
+    >>> import numpy as np
+    >>> y_values = np.array([5, 20, 4, 18, 19, 18, 7, 4])
+    >>> area = utils.integral_area_trapz(y_values, dx=5)
+    >>> area
+    452.5
+    """
+
+    return np.trapz(y_values, dx=dx)
+
+
+def integral_area_simps(y_values, dx):
+    """Returns area under curves from provided data points using Simpsons rule
+
+    Args:
+        points: array of point coordinates
+        dx: number of unit for x axis
+
+    Returns:
+        Area under curves obtained from these points
+
+    Example:
+
+    >>> from ipfml import utils
+    >>> import numpy as np
+    >>> y_values = np.array([5, 20, 4, 18, 19, 18, 7, 4])
+    >>> area = utils.integral_area_simps(y_values, dx=5)
+    >>> area
+    460.0
+    """
+
+    return simps(y_values, dx=dx)

+ 4 - 3
setup.py

@@ -16,6 +16,7 @@ class BuildTestCommand(setuptools.command.build_py.build_py):
         from ipfml import metrics
         from ipfml.filters import noise as noise_filters
         from ipfml.iqa import fr as fr_iqa
+        from ipfml import utils
 
         print("==============================")
         print("Runs test command...")
@@ -23,6 +24,7 @@ class BuildTestCommand(setuptools.command.build_py.build_py):
         doctest.testmod(metrics)
         doctest.testmod(noise_filters)
         doctest.testmod(fr_iqa)
+        doctest.testmod(utils)
 
         # Run format code using ypaf
         try:
@@ -37,11 +39,11 @@ class BuildTestCommand(setuptools.command.build_py.build_py):
 
 setup(
     name='ipfml',
-    version='0.3.1',
+    version='0.3.2',
     description='Image Processing For Machine Learning',
     long_description=readme(),
     classifiers=[
-        'Development Status :: 3 - Alpha',
+        'Development Status :: 4 - Beta',
         'License :: OSI Approved :: MIT License',
         'Programming Language :: Python :: 3.6',
         'Topic :: Scientific/Engineering :: Artificial Intelligence'
@@ -52,7 +54,6 @@ setup(
     license='MIT',
     packages=['ipfml', 'ipfml/filters', 'ipfml/iqa'],
     install_requires=[
-        'matplotlib',
         'numpy',
         'Pillow',
         'sklearn',