|
@@ -92,6 +92,12 @@
|
|
|
<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>
|
|
|
+<li class="toctree-l2"><a class="reference internal" href="#module-ipfml.utils">ipfml.utils</a></li>
|
|
|
+<li class="toctree-l2"><a class="reference internal" href="#module-ipfml.exceptions">ipfml.exceptions</a></li>
|
|
|
</ul>
|
|
|
</li>
|
|
|
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
|
|
@@ -716,82 +722,6 @@
|
|
|
</div>
|
|
|
</dd></dl>
|
|
|
|
|
|
-<dl class="function">
|
|
|
-<dt id="ipfml.processing.normalize_2D_arr">
|
|
|
-<code class="descclassname">ipfml.processing.</code><code class="descname">normalize_2D_arr</code><span class="sig-paren">(</span><em>arr</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.normalize_2D_arr" title="Permalink to this definition">¶</a></dt>
|
|
|
-<dd><p>Return array normalize from its min and max values</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"><strong>arr</strong> – 2D Numpy array</td>
|
|
|
-</tr>
|
|
|
-<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Normalized 2D Numpy array</td>
|
|
|
-</tr>
|
|
|
-</tbody>
|
|
|
-</table>
|
|
|
-<p>Example:</p>
|
|
|
-<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">PIL</span> <span class="k">import</span> <span class="n">Image</span>
|
|
|
-<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml</span> <span class="k">import</span> <span class="n">processing</span>
|
|
|
-<span class="gp">>>> </span><span class="n">img</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="s1">'./images/test_img.png'</span><span class="p">)</span>
|
|
|
-<span class="gp">>>> </span><span class="n">img_mscn</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">rgb_to_mscn</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
|
|
|
-<span class="gp">>>> </span><span class="n">img_normalized</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">normalize_2D_arr</span><span class="p">(</span><span class="n">img_mscn</span><span class="p">)</span>
|
|
|
-<span class="gp">>>> </span><span class="n">img_normalized</span><span class="o">.</span><span class="n">shape</span>
|
|
|
-<span class="go">(200, 200)</span>
|
|
|
-</pre></div>
|
|
|
-</div>
|
|
|
-</dd></dl>
|
|
|
-
|
|
|
-<dl class="function">
|
|
|
-<dt id="ipfml.processing.normalize_arr">
|
|
|
-<code class="descclassname">ipfml.processing.</code><code class="descname">normalize_arr</code><span class="sig-paren">(</span><em>arr</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.normalize_arr" title="Permalink to this definition">¶</a></dt>
|
|
|
-<dd><p>Normalize data of 1D array shape</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"><strong>arr</strong> – array data of 1D shape</td>
|
|
|
-</tr>
|
|
|
-<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Normalized 1D array</td>
|
|
|
-</tr>
|
|
|
-</tbody>
|
|
|
-</table>
|
|
|
-<p>Example:</p>
|
|
|
-<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml</span> <span class="k">import</span> <span class="n">processing</span>
|
|
|
-<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
|
|
-<span class="gp">>>> </span><span class="n">arr</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span>
|
|
|
-<span class="gp">>>> </span><span class="n">arr_normalized</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">normalize_arr</span><span class="p">(</span><span class="n">arr</span><span class="p">)</span>
|
|
|
-<span class="gp">>>> </span><span class="n">arr_normalized</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
|
|
|
-<span class="go">0.1</span>
|
|
|
-</pre></div>
|
|
|
-</div>
|
|
|
-</dd></dl>
|
|
|
-
|
|
|
-<dl class="function">
|
|
|
-<dt id="ipfml.processing.normalize_arr_with_range">
|
|
|
-<code class="descclassname">ipfml.processing.</code><code class="descname">normalize_arr_with_range</code><span class="sig-paren">(</span><em>arr</em>, <em>min</em>, <em>max</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.normalize_arr_with_range" title="Permalink to this definition">¶</a></dt>
|
|
|
-<dd><p>Normalize data of 1D array shape</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"><strong>arr</strong> – array data of 1D shape</td>
|
|
|
-</tr>
|
|
|
-<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Normalized 1D Numpy array</td>
|
|
|
-</tr>
|
|
|
-</tbody>
|
|
|
-</table>
|
|
|
-<p>Example:</p>
|
|
|
-<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml</span> <span class="k">import</span> <span class="n">processing</span>
|
|
|
-<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
|
|
-<span class="gp">>>> </span><span class="n">arr</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span>
|
|
|
-<span class="gp">>>> </span><span class="n">arr_normalized</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">normalize_arr_with_range</span><span class="p">(</span><span class="n">arr</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
|
|
|
-<span class="gp">>>> </span><span class="n">arr_normalized</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
|
|
|
-<span class="go">0.05</span>
|
|
|
-</pre></div>
|
|
|
-</div>
|
|
|
-</dd></dl>
|
|
|
-
|
|
|
<dl class="function">
|
|
|
<dt id="ipfml.processing.rgb_to_LAB_L_bits">
|
|
|
<code class="descclassname">ipfml.processing.</code><code class="descname">rgb_to_LAB_L_bits</code><span class="sig-paren">(</span><em>image</em>, <em>interval</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.rgb_to_LAB_L_bits" title="Permalink to this definition">¶</a></dt>
|
|
@@ -1055,7 +985,7 @@
|
|
|
<li><strong>image</strong> – image used as input (2D or 3D image representation)</li>
|
|
|
<li><strong>n</strong> – used to set importance of noise [1, 999]</li>
|
|
|
<li><strong>identical</strong> – keep or not identical noise distribution for each canal if RGB Image (default False)</li>
|
|
|
-<li><strong>distribution_interval</strong> – set the distribution interval of normal law distribution (default (-0.5, 0.5))</li>
|
|
|
+<li><strong>distribution_interval</strong> – set the distribution interval of normal law distribution (default (0, 1))</li>
|
|
|
<li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.002)</li>
|
|
|
</ul>
|
|
|
</td>
|
|
@@ -1143,6 +1073,254 @@
|
|
|
</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>img_true</em>, <em>img_test</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.iqa.fr.mae" title="Permalink to this definition">¶</a></dt>
|
|
|
+<dd><p>Returns Mean Absolute Error between two Numpy arrays</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>img_true</strong> – Image, numpy array of any dimension</li>
|
|
|
+<li><strong>img_test</strong> – Image, numpy array of any dimension</li>
|
|
|
+</ul>
|
|
|
+</td>
|
|
|
+</tr>
|
|
|
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Computed MAE score</p>
|
|
|
+</td>
|
|
|
+</tr>
|
|
|
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NumpyShapeComparisonException</span></code> – if shape of images are not the same</p>
|
|
|
+</td>
|
|
|
+</tr>
|
|
|
+</tbody>
|
|
|
+</table>
|
|
|
+<p class="rubric">Example</p>
|
|
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml.iqa</span> <span class="k">import</span> <span class="n">fr</span>
|
|
|
+<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr1</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr2</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">mae_score</span> <span class="o">=</span> <span class="n">fr</span><span class="o">.</span><span class="n">mae</span><span class="p">(</span><span class="n">arr1</span><span class="p">,</span> <span class="n">arr2</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">mae_score</span>
|
|
|
+<span class="go">5.0</span>
|
|
|
+</pre></div>
|
|
|
+</div>
|
|
|
+</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>img_true</em>, <em>img_test</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.iqa.fr.ms_ssim" title="Permalink to this definition">¶</a></dt>
|
|
|
+<dd><p>Implemented later..</p>
|
|
|
+</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>img_true</em>, <em>img_test</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.iqa.fr.mse" title="Permalink to this definition">¶</a></dt>
|
|
|
+<dd><p>Returns Mean-Squared Error score between two Numpy arrays</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>img_true</strong> – Image, numpy array of any dimension</li>
|
|
|
+<li><strong>img_test</strong> – Image, numpy array of any dimension</li>
|
|
|
+</ul>
|
|
|
+</td>
|
|
|
+</tr>
|
|
|
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Computed MSE score</p>
|
|
|
+</td>
|
|
|
+</tr>
|
|
|
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NumpyShapeComparisonException</span></code> – if shape of images are not the same</p>
|
|
|
+</td>
|
|
|
+</tr>
|
|
|
+</tbody>
|
|
|
+</table>
|
|
|
+<p class="rubric">Example</p>
|
|
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml.iqa</span> <span class="k">import</span> <span class="n">fr</span>
|
|
|
+<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr1</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr2</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">mse_score</span> <span class="o">=</span> <span class="n">fr</span><span class="o">.</span><span class="n">mse</span><span class="p">(</span><span class="n">arr1</span><span class="p">,</span> <span class="n">arr2</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">mse_score</span>
|
|
|
+<span class="go">25.0</span>
|
|
|
+</pre></div>
|
|
|
+</div>
|
|
|
+</dd></dl>
|
|
|
+
|
|
|
+<dl class="function">
|
|
|
+<dt id="ipfml.iqa.fr.pnsr">
|
|
|
+<code class="descclassname">ipfml.iqa.fr.</code><code class="descname">pnsr</code><span class="sig-paren">(</span><em>img_true</em>, <em>img_test</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.iqa.fr.pnsr" title="Permalink to this definition">¶</a></dt>
|
|
|
+<dd><p>Returns the computed Peak Signal to Noise Ratio (PSNR) 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>img_true</strong> – Image, numpy array of any dimension</li>
|
|
|
+<li><strong>img_test</strong> – Image, numpy array of any dimension</li>
|
|
|
+</ul>
|
|
|
+</td>
|
|
|
+</tr>
|
|
|
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Computed PSNR score</p>
|
|
|
+</td>
|
|
|
+</tr>
|
|
|
+</tbody>
|
|
|
+</table>
|
|
|
+<p class="rubric">Example</p>
|
|
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml.iqa</span> <span class="k">import</span> <span class="n">fr</span>
|
|
|
+<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr1</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr2</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">pnsr_score</span> <span class="o">=</span> <span class="n">fr</span><span class="o">.</span><span class="n">pnsr</span><span class="p">(</span><span class="n">arr1</span><span class="p">,</span> <span class="n">arr2</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="nb">int</span><span class="p">(</span><span class="n">pnsr_score</span><span class="p">)</span>
|
|
|
+<span class="go">365</span>
|
|
|
+</pre></div>
|
|
|
+</div>
|
|
|
+</dd></dl>
|
|
|
+
|
|
|
+<dl class="function">
|
|
|
+<dt id="ipfml.iqa.fr.rmse">
|
|
|
+<code class="descclassname">ipfml.iqa.fr.</code><code class="descname">rmse</code><span class="sig-paren">(</span><em>img_true</em>, <em>img_test</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.iqa.fr.rmse" title="Permalink to this definition">¶</a></dt>
|
|
|
+<dd><p>Returns Root Mean-Squared Error score between two Numpy arrays</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>img_true</strong> – Image, numpy array of any dimension</li>
|
|
|
+<li><strong>img_test</strong> – Image, numpy array of any dimension</li>
|
|
|
+</ul>
|
|
|
+</td>
|
|
|
+</tr>
|
|
|
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Computed RMSE score</p>
|
|
|
+</td>
|
|
|
+</tr>
|
|
|
+<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NumpyShapeComparisonException</span></code> – if shape of images are not the same</p>
|
|
|
+</td>
|
|
|
+</tr>
|
|
|
+</tbody>
|
|
|
+</table>
|
|
|
+<p class="rubric">Example</p>
|
|
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml.iqa</span> <span class="k">import</span> <span class="n">fr</span>
|
|
|
+<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr1</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr2</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">rmse_score</span> <span class="o">=</span> <span class="n">fr</span><span class="o">.</span><span class="n">rmse</span><span class="p">(</span><span class="n">arr1</span><span class="p">,</span> <span class="n">arr2</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">rmse_score</span>
|
|
|
+<span class="go">5.0</span>
|
|
|
+</pre></div>
|
|
|
+</div>
|
|
|
+</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>img_true</em>, <em>img_test</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.iqa.fr.vif" title="Permalink to this definition">¶</a></dt>
|
|
|
+<dd><p>Implemented later..</p>
|
|
|
+</dd></dl>
|
|
|
+
|
|
|
+</div>
|
|
|
+</div>
|
|
|
+<div class="section" id="module-ipfml.utils">
|
|
|
+<span id="ipfml-utils"></span><h2>ipfml.utils<a class="headerlink" href="#module-ipfml.utils" title="Permalink to this headline">¶</a></h2>
|
|
|
+<dl class="function">
|
|
|
+<dt id="ipfml.utils.normalize_2D_arr">
|
|
|
+<code class="descclassname">ipfml.utils.</code><code class="descname">normalize_2D_arr</code><span class="sig-paren">(</span><em>arr</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.utils.normalize_2D_arr" title="Permalink to this definition">¶</a></dt>
|
|
|
+<dd><p>Return array normalize from its min and max values</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"><strong>arr</strong> – 2D Numpy array</td>
|
|
|
+</tr>
|
|
|
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Normalized 2D Numpy array</td>
|
|
|
+</tr>
|
|
|
+</tbody>
|
|
|
+</table>
|
|
|
+<p>Example:</p>
|
|
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">PIL</span> <span class="k">import</span> <span class="n">Image</span>
|
|
|
+<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml</span> <span class="k">import</span> <span class="n">utils</span><span class="p">,</span> <span class="n">processing</span>
|
|
|
+<span class="gp">>>> </span><span class="n">img</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="s1">'./images/test_img.png'</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">img_mscn</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">rgb_to_mscn</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">img_normalized</span> <span class="o">=</span> <span class="n">utils</span><span class="o">.</span><span class="n">normalize_2D_arr</span><span class="p">(</span><span class="n">img_mscn</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">img_normalized</span><span class="o">.</span><span class="n">shape</span>
|
|
|
+<span class="go">(200, 200)</span>
|
|
|
+</pre></div>
|
|
|
+</div>
|
|
|
+</dd></dl>
|
|
|
+
|
|
|
+<dl class="function">
|
|
|
+<dt id="ipfml.utils.normalize_arr">
|
|
|
+<code class="descclassname">ipfml.utils.</code><code class="descname">normalize_arr</code><span class="sig-paren">(</span><em>arr</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.utils.normalize_arr" title="Permalink to this definition">¶</a></dt>
|
|
|
+<dd><p>Normalize data of 1D array shape</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"><strong>arr</strong> – array data of 1D shape</td>
|
|
|
+</tr>
|
|
|
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Normalized 1D array</td>
|
|
|
+</tr>
|
|
|
+</tbody>
|
|
|
+</table>
|
|
|
+<p>Example:</p>
|
|
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml</span> <span class="k">import</span> <span class="n">utils</span>
|
|
|
+<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr_normalized</span> <span class="o">=</span> <span class="n">utils</span><span class="o">.</span><span class="n">normalize_arr</span><span class="p">(</span><span class="n">arr</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr_normalized</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
|
|
|
+<span class="go">0.1</span>
|
|
|
+</pre></div>
|
|
|
+</div>
|
|
|
+</dd></dl>
|
|
|
+
|
|
|
+<dl class="function">
|
|
|
+<dt id="ipfml.utils.normalize_arr_with_range">
|
|
|
+<code class="descclassname">ipfml.utils.</code><code class="descname">normalize_arr_with_range</code><span class="sig-paren">(</span><em>arr</em>, <em>min</em>, <em>max</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.utils.normalize_arr_with_range" title="Permalink to this definition">¶</a></dt>
|
|
|
+<dd><p>Normalize data of 1D array shape</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"><strong>arr</strong> – array data of 1D shape</td>
|
|
|
+</tr>
|
|
|
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Normalized 1D Numpy array</td>
|
|
|
+</tr>
|
|
|
+</tbody>
|
|
|
+</table>
|
|
|
+<p>Example:</p>
|
|
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml</span> <span class="k">import</span> <span class="n">processing</span>
|
|
|
+<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr_normalized</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">normalize_arr_with_range</span><span class="p">(</span><span class="n">arr</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
|
|
|
+<span class="gp">>>> </span><span class="n">arr_normalized</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
|
|
|
+<span class="go">0.05</span>
|
|
|
+</pre></div>
|
|
|
+</div>
|
|
|
+</dd></dl>
|
|
|
+
|
|
|
+</div>
|
|
|
+<div class="section" id="module-ipfml.exceptions">
|
|
|
+<span id="ipfml-exceptions"></span><h2>ipfml.exceptions<a class="headerlink" href="#module-ipfml.exceptions" title="Permalink to this headline">¶</a></h2>
|
|
|
+<p>Module which contains all customs Exceptions</p>
|
|
|
+<dl class="exception">
|
|
|
+<dt id="ipfml.exceptions.NumpyDimensionComparisonException">
|
|
|
+<em class="property">exception </em><code class="descclassname">ipfml.exceptions.</code><code class="descname">NumpyDimensionComparisonException</code><a class="headerlink" href="#ipfml.exceptions.NumpyDimensionComparisonException" title="Permalink to this definition">¶</a></dt>
|
|
|
+<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
|
|
|
+<p>Numpy dimensions comparison Exception raised if two numpy arrays provided do not have same dimensions</p>
|
|
|
+</dd></dl>
|
|
|
+
|
|
|
+<dl class="exception">
|
|
|
+<dt id="ipfml.exceptions.NumpyShapeComparisonException">
|
|
|
+<em class="property">exception </em><code class="descclassname">ipfml.exceptions.</code><code class="descname">NumpyShapeComparisonException</code><a class="headerlink" href="#ipfml.exceptions.NumpyShapeComparisonException" title="Permalink to this definition">¶</a></dt>
|
|
|
+<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
|
|
|
+<p>Numpy shape comparison Exception raised if two numpy arrays provided do not have same shape extactly</p>
|
|
|
+</dd></dl>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
|