123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206 |
- <!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.2 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.2
- </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>
- </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="_sources/ipfml.rst.txt" rel="nofollow"> View page source</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.normalize_2D_arr">
- <code class="descclassname">ipfml.processing.</code><code class="descname">normalize_2D_arr</code><span class="sig-paren">(</span><em>arr</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.normalize_2D_arr" title="Permalink to this definition">¶</a></dt>
- <dd><p>Return array normalize from its min and max values</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>arr</strong> – 2D Numpy array</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Normalized 2D Numpy array</td>
- </tr>
- </tbody>
- </table>
- <p>Example:</p>
- <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">PIL</span> <span class="k">import</span> <span class="n">Image</span>
- <span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml</span> <span class="k">import</span> <span class="n">processing</span>
- <span class="gp">>>> </span><span class="n">img</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="s1">'./images/test_img.png'</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">img_mscn</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">rgb_to_mscn</span><span class="p">(</span><span class="n">img</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">img_normalized</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">normalize_2D_arr</span><span class="p">(</span><span class="n">img_mscn</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">img_normalized</span><span class="o">.</span><span class="n">shape</span>
- <span class="go">(200, 200)</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.processing.normalize_arr">
- <code class="descclassname">ipfml.processing.</code><code class="descname">normalize_arr</code><span class="sig-paren">(</span><em>arr</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.normalize_arr" title="Permalink to this definition">¶</a></dt>
- <dd><p>Normalize data of 1D array shape</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>arr</strong> – array data of 1D shape</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Normalized 1D array</td>
- </tr>
- </tbody>
- </table>
- <p>Example:</p>
- <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml</span> <span class="k">import</span> <span class="n">processing</span>
- <span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
- <span class="gp">>>> </span><span class="n">arr</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">arr_normalized</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">normalize_arr</span><span class="p">(</span><span class="n">arr</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">arr_normalized</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
- <span class="go">0.1</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.processing.normalize_arr_with_range">
- <code class="descclassname">ipfml.processing.</code><code class="descname">normalize_arr_with_range</code><span class="sig-paren">(</span><em>arr</em>, <em>min</em>, <em>max</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.normalize_arr_with_range" title="Permalink to this definition">¶</a></dt>
- <dd><p>Normalize data of 1D array shape</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>arr</strong> – array data of 1D shape</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Normalized 1D Numpy array</td>
- </tr>
- </tbody>
- </table>
- <p>Example:</p>
- <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">ipfml</span> <span class="k">import</span> <span class="n">processing</span>
- <span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
- <span class="gp">>>> </span><span class="n">arr</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">arr_normalized</span> <span class="o">=</span> <span class="n">processing</span><span class="o">.</span><span class="n">normalize_arr_with_range</span><span class="p">(</span><span class="n">arr</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
- <span class="gp">>>> </span><span class="n">arr_normalized</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
- <span class="go">0.05</span>
- </pre></div>
- </div>
- </dd></dl>
- <dl class="function">
- <dt id="ipfml.processing.rgb_to_LAB_L_bits">
- <code class="descclassname">ipfml.processing.</code><code class="descname">rgb_to_LAB_L_bits</code><span class="sig-paren">(</span><em>image</em>, <em>interval</em><span class="sig-paren">)</span><a class="headerlink" href="#ipfml.processing.rgb_to_LAB_L_bits" title="Permalink to this definition">¶</a></dt>
- <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.5</em>, <em>0.5)</em>, <em>k=0.2</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.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 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>
- </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>
|