Parcourir la source

Update of mut_white noise

Jérôme BUISINE il y a 5 ans
Parent
commit
126435bc6a

BIN
docs/build/doctrees/environment.pickle


BIN
docs/build/doctrees/ipfml.doctree


+ 11 - 1
docs/build/html/_sources/ipfml.rst.txt

@@ -25,4 +25,14 @@ ipfml.filters.noise
 .. automodule:: ipfml.filters.noise
     :members:
     :show-inheritance:
- 
+
+ipfml.iqa
+---------------------------
+
+ipfml.iqa.fr
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: ipfml.iqa.fr
+    :members:
+    :show-inheritance:
+

+ 23 - 0
docs/build/html/genindex.html

@@ -166,6 +166,7 @@
  | <a href="#N"><strong>N</strong></a>
  | <a href="#R"><strong>R</strong></a>
  | <a href="#S"><strong>S</strong></a>
+ | <a href="#V"><strong>V</strong></a>
  | <a href="#W"><strong>W</strong></a>
  
 </div>
@@ -237,6 +238,8 @@
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%; vertical-align: top;"><ul>
       <li><a href="ipfml.html#module-ipfml.filters.noise">ipfml.filters.noise (module)</a>
+</li>
+      <li><a href="ipfml.html#module-ipfml.iqa.fr">ipfml.iqa.fr (module)</a>
 </li>
   </ul></td>
   <td style="width: 33%; vertical-align: top;"><ul>
@@ -262,6 +265,14 @@
 <h2 id="M">M</h2>
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%; vertical-align: top;"><ul>
+      <li><a href="ipfml.html#ipfml.iqa.fr.mae">mae() (in module ipfml.iqa.fr)</a>
+</li>
+      <li><a href="ipfml.html#ipfml.iqa.fr.ms_ssim">ms_ssim() (in module ipfml.iqa.fr)</a>
+</li>
+  </ul></td>
+  <td style="width: 33%; vertical-align: top;"><ul>
+      <li><a href="ipfml.html#ipfml.iqa.fr.mse">mse() (in module ipfml.iqa.fr)</a>
+</li>
       <li><a href="ipfml.html#ipfml.filters.noise.mut_white_noise">mut_white_noise() (in module ipfml.filters.noise)</a>
 </li>
   </ul></td>
@@ -301,6 +312,18 @@
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%; vertical-align: top;"><ul>
       <li><a href="ipfml.html#ipfml.filters.noise.salt_pepper_noise">salt_pepper_noise() (in module ipfml.filters.noise)</a>
+</li>
+  </ul></td>
+  <td style="width: 33%; vertical-align: top;"><ul>
+      <li><a href="ipfml.html#ipfml.iqa.fr.ssim">ssim() (in module ipfml.iqa.fr)</a>
+</li>
+  </ul></td>
+</tr></table>
+
+<h2 id="V">V</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+  <td style="width: 33%; vertical-align: top;"><ul>
+      <li><a href="ipfml.html#ipfml.iqa.fr.vif">vif() (in module ipfml.iqa.fr)</a>
 </li>
   </ul></td>
 </tr></table>

+ 1 - 0
docs/build/html/index.html

@@ -172,6 +172,7 @@
 <li class="toctree-l2"><a class="reference internal" href="ipfml.html#module-ipfml.metrics">ipfml.metrics</a></li>
 <li class="toctree-l2"><a class="reference internal" href="ipfml.html#module-ipfml.processing">ipfml.processing</a></li>
 <li class="toctree-l2"><a class="reference internal" href="ipfml.html#ipfml-filters">ipfml.filters</a></li>
+<li class="toctree-l2"><a class="reference internal" href="ipfml.html#ipfml-iqa">ipfml.iqa</a></li>
 </ul>
 </li>
 <li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a><ul>

+ 52 - 1
docs/build/html/ipfml.html

@@ -92,6 +92,10 @@
 <li class="toctree-l3"><a class="reference internal" href="#module-ipfml.filters.noise">ipfml.filters.noise</a></li>
 </ul>
 </li>
+<li class="toctree-l2"><a class="reference internal" href="#ipfml-iqa">ipfml.iqa</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="#module-ipfml.iqa.fr">ipfml.iqa.fr</a></li>
+</ul>
+</li>
 </ul>
 </li>
 <li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
@@ -1045,7 +1049,7 @@
 
 <dl class="function">
 <dt id="ipfml.filters.noise.mut_white_noise">
-<code class="descclassname">ipfml.filters.noise.</code><code class="descname">mut_white_noise</code><span class="sig-paren">(</span><em>image</em>, <em>n</em>, <em>identical=False</em>, <em>distribution_interval=(0</em>, <em>1)</em>, <em>k=0.002</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.filters.noise.mut_white_noise" title="Permalink to this definition">¶</a></dt>
+<code class="descclassname">ipfml.filters.noise.</code><code class="descname">mut_white_noise</code><span class="sig-paren">(</span><em>image</em>, <em>n</em>, <em>identical=False</em>, <em>distribution_interval=(-0.5</em>, <em>0.5)</em>, <em>k=0.002</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.filters.noise.mut_white_noise" title="Permalink to this definition">¶</a></dt>
 <dd><p>Multiplied White noise filter to apply on image</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -1142,6 +1146,53 @@
 </div>
 </dd></dl>
 
+</div>
+</div>
+<div class="section" id="ipfml-iqa">
+<h2>ipfml.iqa<a class="headerlink" href="#ipfml-iqa" title="Permalink to this headline">¶</a></h2>
+<div class="section" id="module-ipfml.iqa.fr">
+<span id="ipfml-iqa-fr"></span><h3>ipfml.iqa.fr<a class="headerlink" href="#module-ipfml.iqa.fr" title="Permalink to this headline">¶</a></h3>
+<dl class="function">
+<dt id="ipfml.iqa.fr.mae">
+<code class="descclassname">ipfml.iqa.fr.</code><code class="descname">mae</code><span class="sig-paren">(</span><em>I</em>, <em>K</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.iqa.fr.mae" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="function">
+<dt id="ipfml.iqa.fr.ms_ssim">
+<code class="descclassname">ipfml.iqa.fr.</code><code class="descname">ms_ssim</code><span class="sig-paren">(</span><em>I</em>, <em>K</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.iqa.fr.ms_ssim" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="function">
+<dt id="ipfml.iqa.fr.mse">
+<code class="descclassname">ipfml.iqa.fr.</code><code class="descname">mse</code><span class="sig-paren">(</span><em>I</em>, <em>K</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.iqa.fr.mse" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns difference between two images</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
+<li><strong>I</strong> – PIL Image or Numpy array</li>
+<li><strong>K</strong> – PIL Image or Numpy array</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">comparison score between these two images</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="ipfml.iqa.fr.ssim">
+<code class="descclassname">ipfml.iqa.fr.</code><code class="descname">ssim</code><span class="sig-paren">(</span><em>I</em>, <em>K</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.iqa.fr.ssim" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="function">
+<dt id="ipfml.iqa.fr.vif">
+<code class="descclassname">ipfml.iqa.fr.</code><code class="descname">vif</code><span class="sig-paren">(</span><em>I</em>, <em>K</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.iqa.fr.vif" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
 </div>
 </div>
 </div>

BIN
docs/build/html/objects.inv


+ 5 - 0
docs/build/html/py-modindex.html

@@ -171,6 +171,11 @@
        <td>&#160;&#160;&#160;
        <a href="ipfml.html#module-ipfml.filters.noise"><code class="xref">ipfml.filters.noise</code></a></td><td>
        <em></em></td></tr>
+     <tr class="cg-1">
+       <td></td>
+       <td>&#160;&#160;&#160;
+       <a href="ipfml.html#module-ipfml.iqa.fr"><code class="xref">ipfml.iqa.fr</code></a></td><td>
+       <em></em></td></tr>
      <tr class="cg-1">
        <td></td>
        <td>&#160;&#160;&#160;

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


+ 11 - 1
docs/source/ipfml.rst

@@ -25,4 +25,14 @@ ipfml.filters.noise
 .. automodule:: ipfml.filters.noise
     :members:
     :show-inheritance:
- 
+
+ipfml.iqa
+---------------------------
+
+ipfml.iqa.fr
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: ipfml.iqa.fr
+    :members:
+    :show-inheritance:
+

+ 6 - 3
ipfml/filters/noise.py

@@ -284,7 +284,7 @@ def mut_white_noise(image,
         image: image used as input (2D or 3D image representation)
         n: used to set importance of noise [1, 999]
         identical: keep or not identical noise distribution for each canal if RGB Image (default False)
-        distribution_interval: set the distribution interval of normal law distribution (default (-0.5, 0.5))
+        distribution_interval: set the distribution interval of normal law distribution (default (0, 1))
         k: variable that specifies the amount of noise to be taken into account in the output image (default 0.002)
 
     Returns:
@@ -300,10 +300,13 @@ def mut_white_noise(image,
     (100, 100)
     """
 
+    min_value = 1 - (k/2);
+    max_value = 1 + (k/2);
+
     a, b = distribution_interval
-    generator = lambda h, w: np.random.uniform(a, b, (h, w))
+    generator = lambda h, w: min_value + (np.random.uniform(a, b, (h, w)) * (max_value - min_value))
 
-    updator = lambda x, noise: x * (n * k * noise)
+    updator = lambda x, noise: x * pow(noise, n)
 
     return _global_noise_filter(image, generator, updator, identical)
 

+ 0 - 0
ipfml/iqa/__init__.py


+ 40 - 0
ipfml/iqa/fr.py

@@ -0,0 +1,40 @@
+# Add PNSR, SSIM, VIF
+
+
+def pnsr(img, dist_img):
+
+    pass
+
+def mse(I, K):
+    """Returns difference between two images
+
+    Args:
+        I: PIL Image or Numpy array
+        K: PIL Image or Numpy array
+
+    Returns:
+        comparison score between these two images
+    """
+    pass
+
+def mae(I, K):
+    """
+
+    """
+    pass
+
+
+def ssim(I, K):
+    """
+
+    """
+
+def ms_ssim(I, K):
+    """
+
+    """
+
+def vif(I, K):
+    """
+
+    """

+ 5 - 3
setup.py

@@ -15,12 +15,14 @@ class BuildTestCommand(setuptools.command.build_py.build_py):
         from ipfml import processing
         from ipfml import metrics
         from ipfml.filters import noise as noise_filters
+        from ipfml.iqa import fr as fr_iqa
 
         print("==============================")
         print("Runs test command...")
         doctest.testmod(processing)
         doctest.testmod(metrics)
         doctest.testmod(noise_filters)
+        doctest.testmod(fr_iqa)
 
         # Run format code using ypaf
         try:
@@ -35,7 +37,7 @@ class BuildTestCommand(setuptools.command.build_py.build_py):
 
 setup(
     name='ipfml',
-    version='0.2.6',
+    version='0.2.7',
     description='Image Processing For Machine Learning',
     long_description=readme(),
     classifiers=[
@@ -44,11 +46,11 @@ setup(
         'Programming Language :: Python :: 3.6',
         'Topic :: Scientific/Engineering :: Artificial Intelligence'
     ],
-    url='https://gogs.univ-littoral.fr/jerome.buisine/IPFML',
+    url='https://github.com/jbuisine/IPFML',
     author='Jérôme BUISINE',
     author_email='jerome.buisine@univ-littoral.fr',
     license='MIT',
-    packages=['ipfml', 'ipfml/filters'],
+    packages=['ipfml', 'ipfml/filters', 'ipfml/iqa'],
     install_requires=[
         'matplotlib',
         'numpy',