12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376 |
- <!DOCTYPE html>
- <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
- <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
- <head>
- <meta charset="utf-8">
-
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
-
- <title>Documentation — IPFML v0.2.6 documentation</title>
-
-
-
-
-
-
-
-
-
-
- <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <link rel="index" title="Index" href="genindex.html" />
- <link rel="search" title="Search" href="search.html" />
- <link rel="next" title="Examples" href="examples.html" />
- <link rel="prev" title="Description" href="description.html" />
-
- <script src="_static/js/modernizr.min.js"></script>
- </head>
- <body class="wy-body-for-nav">
-
- <div class="wy-grid-for-nav">
-
- <nav data-toggle="wy-nav-shift" class="wy-nav-side">
- <div class="wy-side-scroll">
- <div class="wy-side-nav-search">
-
-
- <a href="index.html" class="icon icon-home"> IPFML
-
-
- </a>
-
-
-
- <div class="version">
- 0.2.6
- </div>
-
-
-
- <div role="search">
- <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
- <input type="text" name="q" placeholder="Search docs" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
-
- </div>
- <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
-
-
-
-
-
-
- <p class="caption"><span class="caption-text">Contents:</span></p>
- <ul class="current">
- <li class="toctree-l1"><a class="reference internal" href="description.html">Description</a></li>
- <li class="toctree-l1 current"><a class="current reference internal" href="#">Documentation</a><ul>
- <li class="toctree-l2"><a class="reference internal" href="#module-ipfml.metrics">ipfml.metrics</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#module-ipfml.processing">ipfml.processing</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#ipfml-filters">ipfml.filters</a><ul>
- <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>
- <li class="toctree-l1"><a class="reference internal" href="contributing.html">Contributing</a></li>
- </ul>
-
-
- </div>
- </div>
- </nav>
- <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
-
- <nav class="wy-nav-top" aria-label="top navigation">
-
- <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
- <a href="index.html">IPFML</a>
-
- </nav>
- <div class="wy-nav-content">
-
- <div class="rst-content">
-
-
- <div role="navigation" aria-label="breadcrumbs navigation">
- <ul class="wy-breadcrumbs">
-
- <li><a href="index.html">Docs</a> »</li>
-
- <li>Documentation</li>
-
-
- <li class="wy-breadcrumbs-aside">
-
-
-
- <a href="https://github.com/jbuisine/IPFML/blob/master/docs/source/ipfml.rst" class="fa fa-github"> Edit on GitHub</a>
-
-
-
- </li>
-
- </ul>
-
- <hr/>
- </div>
- <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
- <div itemprop="articleBody">
-
- <div class="section" id="documentation">
- <h1>Documentation<a class="headerlink" href="#documentation" title="Permalink to this headline">¶</a></h1>
- <div class="section" id="module-ipfml.metrics">
- <span id="ipfml-metrics"></span><h2>ipfml.metrics<a class="headerlink" href="#module-ipfml.metrics" title="Permalink to this headline">¶</a></h2>
- <dl class="function">
- <dt id="ipfml.metrics.get_LAB">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_LAB</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_LAB" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms RGB Image into Lab</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>image</strong> – image to convert</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Lab information</td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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">metrics</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">Lab</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_LAB</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">Lab</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 200, 3)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.metrics.get_LAB_L">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_LAB_L</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_LAB_L" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms RGB Image into Lab and returns L</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>image</strong> – image to convert</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The L chanel from Lab information</td>
- </tr>
- </tbody>
- </table>
- <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">metrics</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">L</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_LAB_L</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">L</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.metrics.get_LAB_a">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_LAB_a</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_LAB_a" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms RGB Image into LAB and returns a</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>image</strong> – image to convert</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The a chanel from Lab information</td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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">metrics</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">a</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_LAB_a</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">a</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.metrics.get_LAB_b">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_LAB_b</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_LAB_b" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms RGB Image into LAB and returns b</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>image</strong> – image to convert</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The b chanel from Lab information</td>
- </tr>
- </tbody>
- </table>
- <p>Usage :</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">metrics</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">b</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_LAB_b</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">b</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.metrics.get_SVD">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_SVD</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_SVD" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms Image using SVD compression</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>image</strong> – image to convert into SVD compression</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">U, s, V obtained from SVD compression</td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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">metrics</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">U</span><span class="p">,</span> <span class="n">s</span><span class="p">,</span> <span class="n">V</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_SVD</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">U</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 200, 3)</span>
- <span class="gp">>>> </span><span class="nb">len</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
- <span class="go">200</span>
- <span class="gp">>>> </span><span class="n">V</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 3, 3)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.metrics.get_SVD_U">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_SVD_U</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_SVD_U" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms Image into SVD and returns only ‘U’ part</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>image</strong> – image to convert</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">U matrix from SVD compression</td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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">metrics</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">U</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_SVD_U</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">U</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 200, 3)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.metrics.get_SVD_V">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_SVD_V</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_SVD_V" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms Image into SVD and returns only ‘V’ part</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>image</strong> – image to convert</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">V matrix obtained from SVD compression</td>
- </tr>
- </tbody>
- </table>
- <p>Usage :</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">metrics</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">V</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_SVD_V</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">V</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 3, 3)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.metrics.get_SVD_s">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_SVD_s</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_SVD_s" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms Image into SVD and returns only ‘s’ part</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>image</strong> – image to convert</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">vector of singular values obtained from SVD compression</td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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">metrics</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">s</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_SVD_s</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="nb">len</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
- <span class="go">200</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.metrics.get_XYZ">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_XYZ</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_XYZ" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms RGB Image into XYZ</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>image</strong> – image to convert</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">XYZ information obtained from transformation</td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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">metrics</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">metrics</span><span class="o">.</span><span class="n">get_XYZ</span><span class="p">(</span><span class="n">img</span><span class="p">)</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 200, 3)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.metrics.get_XYZ_X">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_XYZ_X</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_XYZ_X" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms RGB Image into XYZ and returns X</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>image</strong> – image to convert</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The X chanel from XYZ information</td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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">metrics</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">x</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_XYZ_X</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">x</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.metrics.get_XYZ_Y">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_XYZ_Y</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_XYZ_Y" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms RGB Image into XYZ and returns Y</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>image</strong> – image to convert</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The Y chanel from XYZ information</td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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">metrics</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">y</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_XYZ_Y</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">y</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.metrics.get_XYZ_Z">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_XYZ_Z</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_XYZ_Z" title="Permalink to this definition">¶</a></dt>
- <dd><p>Transforms RGB Image into XYZ and returns Z</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>image</strong> – image to convert</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The Z chanel from XYZ information</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – If <cite>nb_bits</cite> has unexpected value. <cite>nb_bits</cite> needs to be in interval [1, 8].</td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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">metrics</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">z</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_XYZ_Z</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">z</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.metrics.get_bits_img">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_bits_img</code><span class="sig-paren">(</span><em>image</em>, <em>interval</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_bits_img" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns only bits specified into the interval</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>image</strong> – image to convert using this interval of bits value to keep</li>
- <li><strong>interval</strong> – (begin, end) of bits values</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Numpy array with reduced values</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
- <li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – If min value from interval is not >= 1.</li>
- <li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – If max value from interval is not <= 8.</li>
- <li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – If min value from interval >= max value.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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">metrics</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">bits_img</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_bits_img</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="n">bits_img</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 200, 3)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.metrics.get_low_bits_img">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">get_low_bits_img</code><span class="sig-paren">(</span><em>image</em>, <em>nb_bits=4</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.get_low_bits_img" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns Image or Numpy array with data information reduced using only low bits</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>image</strong> – image to convert</li>
- <li><strong>nb_bits</strong> – optional parameter which indicates the number of bits to keep</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Numpy array with reduced values</p>
- </td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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">metrics</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">low_bits_img</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_low_bits_img</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">low_bits_img</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 200, 3)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.metrics.gray_to_mscn">
- <code class="descclassname">ipfml.metrics.</code><code class="descname">gray_to_mscn</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.metrics.gray_to_mscn" title="Permalink to this definition">¶</a></dt>
- <dd><p>Convert Grayscale Image into Mean Subtracted Contrast Normalized (MSCN)</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>image</strong> – grayscale image</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">MSCN matrix obtained from transformation</td>
- </tr>
- </tbody>
- </table>
- <p>Usage:</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_mscn</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 200)</span>
- </pre></div>
- </div>
- </dd></dl>
- </div>
- <div class="section" id="module-ipfml.processing">
- <span id="ipfml-processing"></span><h2>ipfml.processing<a class="headerlink" href="#module-ipfml.processing" title="Permalink to this headline">¶</a></h2>
- <dl class="function">
- <dt id="ipfml.processing.divide_in_blocks">
- <code class="descclassname">ipfml.processing.</code><code class="descname">divide_in_blocks</code><span class="sig-paren">(</span><em>image</em>, <em>block_size</em>, <em>pil=True</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.divide_in_blocks" title="Permalink to this definition">¶</a></dt>
- <dd><p>Divide image into equal size blocks</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>image</strong> – PIL Image or Numpy array</li>
- <li><strong>block</strong> – tuple (width, height) representing the size of each dimension of the block</li>
- <li><strong>pil</strong> – block type returned (default True)</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">list containing all 2D Numpy blocks (in RGB or not)</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">ValueError</span></code> – If <cite>image_width</cite> or <cite>image_heigt</cite> are not compatible to produce correct block sizes</p>
- </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">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</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="kn">from</span> <span class="nn">ipfml</span> <span class="k">import</span> <span class="n">metrics</span>
- <span class="gp">>>> </span><span class="n">image_values</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">800</span><span class="p">,</span> <span class="mi">800</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="n">blocks</span> <span class="o">=</span> <span class="n">divide_in_blocks</span><span class="p">(</span><span class="n">image_values</span><span class="p">,</span> <span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="nb">len</span><span class="p">(</span><span class="n">blocks</span><span class="p">)</span>
- <span class="go">1600</span>
- <span class="gp">>>> </span><span class="n">blocks</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">width</span>
- <span class="go">20</span>
- <span class="gp">>>> </span><span class="n">blocks</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">height</span>
- <span class="go">20</span>
- <span class="gp">>>> </span><span class="n">img_l</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">L</span> <span class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span class="n">get_LAB_L</span><span class="p">(</span><span class="n">img_l</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">blocks_L</span> <span class="o">=</span> <span class="n">divide_in_blocks</span><span class="p">(</span><span class="n">L</span><span class="p">,</span> <span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="nb">len</span><span class="p">(</span><span class="n">blocks_L</span><span class="p">)</span>
- <span class="go">4</span>
- <span class="gp">>>> </span><span class="n">blocks_L</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">width</span>
- <span class="go">100</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.processing.get_LAB_L_SVD">
- <code class="descclassname">ipfml.processing.</code><code class="descname">get_LAB_L_SVD</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.get_LAB_L_SVD" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns Singular values from LAB L Image information</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>image</strong> – PIL Image or Numpy array</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">U, s, V information obtained from SVD compression using Lab</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">U</span><span class="p">,</span> <span class="n">s</span><span class="p">,</span> <span class="n">V</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">get_LAB_L_SVD</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">U</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 200)</span>
- <span class="gp">>>> </span><span class="nb">len</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
- <span class="go">200</span>
- <span class="gp">>>> </span><span class="n">V</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.get_LAB_L_SVD_U">
- <code class="descclassname">ipfml.processing.</code><code class="descname">get_LAB_L_SVD_U</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.get_LAB_L_SVD_U" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns U SVD from L of LAB Image information</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>image</strong> – PIL Image or Numpy array</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">U matrix of SVD compression</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">U</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">get_LAB_L_SVD_U</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">U</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.get_LAB_L_SVD_V">
- <code class="descclassname">ipfml.processing.</code><code class="descname">get_LAB_L_SVD_V</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.get_LAB_L_SVD_V" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns V SVD from L of LAB Image information</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>image</strong> – PIL Image or Numpy array</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">V matrix of SVD compression</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">V</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">get_LAB_L_SVD_V</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">V</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.get_LAB_L_SVD_s">
- <code class="descclassname">ipfml.processing.</code><code class="descname">get_LAB_L_SVD_s</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.get_LAB_L_SVD_s" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns s (Singular values) SVD from L of LAB Image information</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>image</strong> – PIL Image or Numpy array</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">vector of singular values</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">s</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">get_LAB_L_SVD_s</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="nb">len</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
- <span class="go">200</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>
- <dd><p>Returns only bits from LAB L canal specified into the interval</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>image</strong> – image to convert using this interval of bits value to keep</li>
- <li><strong>interval</strong> – (begin, end) of bits values</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">2D Numpy array with reduced values</p>
- </td>
- </tr>
- </tbody>
- </table>
- <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">bits_Lab_l_img</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">rgb_to_LAB_L_bits</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="n">bits_Lab_l_img</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.rgb_to_LAB_L_low_bits">
- <code class="descclassname">ipfml.processing.</code><code class="descname">rgb_to_LAB_L_low_bits</code><span class="sig-paren">(</span><em>image</em>, <em>nb_bits=4</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.rgb_to_LAB_L_low_bits" title="Permalink to this definition">¶</a></dt>
- <dd><p>Convert RGB Image into Lab L channel image using only 4 low bits 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"><ul class="first simple">
- <li><strong>image</strong> – 3D RGB image Numpy array or PIL RGB image</li>
- <li><strong>nb_bits</strong> – optional parameter which indicates the number of bits to keep (default 4)</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">2D Numpy array with low bits information kept</p>
- </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">low_bits_Lab_l_img</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">rgb_to_LAB_L_low_bits</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">low_bits_Lab_l_img</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.rgb_to_grey_low_bits">
- <code class="descclassname">ipfml.processing.</code><code class="descname">rgb_to_grey_low_bits</code><span class="sig-paren">(</span><em>image</em>, <em>nb_bits=4</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.rgb_to_grey_low_bits" title="Permalink to this definition">¶</a></dt>
- <dd><p>Convert RGB Image into grey image using only 4 low bits 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"><ul class="first simple">
- <li><strong>image</strong> – 3D RGB image Numpy array or PIL RGB image</li>
- <li><strong>nb_bits</strong> – optional parameter which indicates the number of bits to keep (default 4)</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">2D Numpy array with low bits information kept</p>
- </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">low_bits_grey_img</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">rgb_to_grey_low_bits</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">low_bits_grey_img</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.rgb_to_mscn">
- <code class="descclassname">ipfml.processing.</code><code class="descname">rgb_to_mscn</code><span class="sig-paren">(</span><em>image</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.rgb_to_mscn" title="Permalink to this definition">¶</a></dt>
- <dd><p>Convert RGB Image into Mean Subtracted Contrast Normalized (MSCN)</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>image</strong> – 3D RGB image Numpy array or PIL RGB image</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">2D Numpy array with MSCN information</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_mscn</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 200)</span>
- </pre></div>
- </div>
- </dd></dl>
- </div>
- <div class="section" id="ipfml-filters">
- <h2>ipfml.filters<a class="headerlink" href="#ipfml-filters" title="Permalink to this headline">¶</a></h2>
- <div class="section" id="module-ipfml.filters.noise">
- <span id="ipfml-filters-noise"></span><h3>ipfml.filters.noise<a class="headerlink" href="#module-ipfml.filters.noise" title="Permalink to this headline">¶</a></h3>
- <dl class="function">
- <dt id="ipfml.filters.noise.cauchy_noise">
- <code class="descclassname">ipfml.filters.noise.</code><code class="descname">cauchy_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.0002</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.filters.noise.cauchy_noise" title="Permalink to this definition">¶</a></dt>
- <dd><p>Cauchy noise filter to apply on image</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>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, 1))</li>
- <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.0002)</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">2D Numpy array with Cauchy noise applied</p>
- </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.filters.noise</span> <span class="k">import</span> <span class="n">cauchy_noise</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">image</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">10000</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span> <span class="o">=</span> <span class="n">cauchy_noise</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(100, 100)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.filters.noise.gaussian_noise">
- <code class="descclassname">ipfml.filters.noise.</code><code class="descname">gaussian_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.1</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.filters.noise.gaussian_noise" title="Permalink to this definition">¶</a></dt>
- <dd><p>Gaussian noise filter to apply on image</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>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, 1))</li>
- <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.1)</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">2D Numpy array with gaussian noise applied</p>
- </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.filters.noise</span> <span class="k">import</span> <span class="n">gaussian_noise</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">image</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">10000</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span> <span class="o">=</span> <span class="n">gaussian_noise</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(100, 100)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.filters.noise.laplace_noise">
- <code class="descclassname">ipfml.filters.noise.</code><code class="descname">laplace_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.1</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.filters.noise.laplace_noise" title="Permalink to this definition">¶</a></dt>
- <dd><p>Laplace noise filter to apply on image</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>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, 1))</li>
- <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.1)</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">2D Numpay array with Laplace noise applied</p>
- </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.filters.noise</span> <span class="k">import</span> <span class="n">laplace_noise</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">image</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">10000</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span> <span class="o">=</span> <span class="n">laplace_noise</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(100, 100)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.filters.noise.log_normal_noise">
- <code class="descclassname">ipfml.filters.noise.</code><code class="descname">log_normal_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.05</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.filters.noise.log_normal_noise" title="Permalink to this definition">¶</a></dt>
- <dd><p>Log-normal noise filter to apply on image</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>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, 1))</li>
- <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.05)</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">2D Numpy array with Log-normal noise applied</p>
- </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.filters.noise</span> <span class="k">import</span> <span class="n">log_normal_noise</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">image</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">10000</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span> <span class="o">=</span> <span class="n">log_normal_noise</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(100, 100)</span>
- </pre></div>
- </div>
- </dd></dl>
- <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>
- <dd><p>Multiplied White noise filter to apply on image</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>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, 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>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">2D Numpy array with multiplied white noise applied</p>
- </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.filters.noise</span> <span class="k">import</span> <span class="n">mut_white_noise</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">image</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">10000</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span> <span class="o">=</span> <span class="n">mut_white_noise</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(100, 100)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.filters.noise.salt_pepper_noise">
- <code class="descclassname">ipfml.filters.noise.</code><code class="descname">salt_pepper_noise</code><span class="sig-paren">(</span><em>image</em>, <em>n</em>, <em>identical=False</em>, <em>p=0.1</em>, <em>k=0.5</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.filters.noise.salt_pepper_noise" title="Permalink to this definition">¶</a></dt>
- <dd><p>Pepper salt noise filter to apply on image</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>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>p</strong> – probability to increase pixel value otherwise decrease it</li>
- <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.5)</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">2D Numpy array with salt and pepper noise applied</p>
- </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.filters.noise</span> <span class="k">import</span> <span class="n">salt_pepper_noise</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">image</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">10000</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span> <span class="o">=</span> <span class="n">salt_pepper_noise</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(100, 100)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.filters.noise.white_noise">
- <code class="descclassname">ipfml.filters.noise.</code><code class="descname">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.2</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.filters.noise.white_noise" title="Permalink to this definition">¶</a></dt>
- <dd><p>White noise filter to apply on image</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>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>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.2)</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">2D Numpy array with white noise applied</p>
- </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.filters.noise</span> <span class="k">import</span> <span class="n">white_noise</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">image</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">10000</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span> <span class="o">=</span> <span class="n">white_noise</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(100, 100)</span>
- </pre></div>
- </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>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-Squared 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 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</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">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">10</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">mse</span> <span class="o">=</span> <span class="n">utils</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</span>
- <span class="go">100</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 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</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">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">10</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">mse</span> <span class="o">=</span> <span class="n">utils</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</span>
- <span class="go">100</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>
- </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 Mean-Squared 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 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</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">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">10</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">rmse</span> <span class="o">=</span> <span class="n">utils</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</span>
- <span class="go">100</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>
- </div>
-
- </div>
- <footer>
-
- <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
-
- <a href="examples.html" class="btn btn-neutral float-right" title="Examples" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
-
-
- <a href="description.html" class="btn btn-neutral" title="Description" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
-
- </div>
-
- <hr/>
- <div role="contentinfo">
- <p>
- © Copyright 2019, Jérôme BUISINE
- </p>
- </div>
- Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
- </footer>
- </div>
- </div>
- </section>
- </div>
-
-
-
-
- <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/underscore.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <script type="text/javascript" src="_static/language_data.js"></script>
-
-
- <script type="text/javascript" src="_static/js/theme.js"></script>
- <script type="text/javascript">
- jQuery(function () {
- SphinxRtdTheme.Navigation.enable(true);
- });
- </script>
- </body>
- </html>
|