ipfml.filters.noise.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <!DOCTYPE html>
  2. <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
  3. <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>ipfml.filters.noise &mdash; IPFML v0.3.4 documentation</title>
  8. <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  9. <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  10. <link rel="index" title="Index" href="../genindex.html" />
  11. <link rel="search" title="Search" href="../search.html" />
  12. <link rel="next" title="ipfml.iqa.fr" href="ipfml.iqa.fr.html" />
  13. <link rel="prev" title="ipfml.exceptions" href="ipfml.exceptions.html" />
  14. <script src="../_static/js/modernizr.min.js"></script>
  15. </head>
  16. <body class="wy-body-for-nav">
  17. <div class="wy-grid-for-nav">
  18. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  19. <div class="wy-side-scroll">
  20. <div class="wy-side-nav-search">
  21. <a href="../index.html" class="icon icon-home"> IPFML
  22. </a>
  23. <div class="version">
  24. 0.3.4
  25. </div>
  26. <div role="search">
  27. <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
  28. <input type="text" name="q" placeholder="Search docs" />
  29. <input type="hidden" name="check_keywords" value="yes" />
  30. <input type="hidden" name="area" value="default" />
  31. </form>
  32. </div>
  33. </div>
  34. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  35. <p class="caption"><span class="caption-text">Contents:</span></p>
  36. <ul class="current">
  37. <li class="toctree-l1"><a class="reference internal" href="../description.html">Description</a></li>
  38. <li class="toctree-l1 current"><a class="reference internal" href="../ipfml.html">Documentation</a><ul class="current">
  39. <li class="toctree-l2"><a class="reference internal" href="ipfml.metrics.html">ipfml.metrics</a></li>
  40. <li class="toctree-l2"><a class="reference internal" href="ipfml.processing.html">ipfml.processing</a></li>
  41. <li class="toctree-l2"><a class="reference internal" href="ipfml.utils.html">ipfml.utils</a></li>
  42. <li class="toctree-l2"><a class="reference internal" href="ipfml.exceptions.html">ipfml.exceptions</a></li>
  43. <li class="toctree-l2 current"><a class="reference internal" href="../ipfml.html#ipfml-filters">ipfml.filters</a><ul class="current">
  44. <li class="toctree-l3 current"><a class="current reference internal" href="#">ipfml.filters.noise</a></li>
  45. </ul>
  46. </li>
  47. <li class="toctree-l2"><a class="reference internal" href="../ipfml.html#ipfml-iqa">ipfml.iqa</a></li>
  48. </ul>
  49. </li>
  50. <li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a></li>
  51. <li class="toctree-l1"><a class="reference internal" href="../contributing.html">Contributing</a></li>
  52. </ul>
  53. </div>
  54. </div>
  55. </nav>
  56. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  57. <nav class="wy-nav-top" aria-label="top navigation">
  58. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  59. <a href="../index.html">IPFML</a>
  60. </nav>
  61. <div class="wy-nav-content">
  62. <div class="rst-content">
  63. <div role="navigation" aria-label="breadcrumbs navigation">
  64. <ul class="wy-breadcrumbs">
  65. <li><a href="../index.html">Docs</a> &raquo;</li>
  66. <li><a href="../ipfml.html">Documentation</a> &raquo;</li>
  67. <li>ipfml.filters.noise</li>
  68. <li class="wy-breadcrumbs-aside">
  69. <a href="https://github.com/jbuisine/IPFML/blob/master/docs/source/ipfml/ipfml.filters.noise.rst" class="fa fa-github"> Edit on GitHub</a>
  70. </li>
  71. </ul>
  72. <hr/>
  73. </div>
  74. <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
  75. <div itemprop="articleBody">
  76. <div class="section" id="module-ipfml.filters.noise">
  77. <span id="ipfml-filters-noise"></span><h1>ipfml.filters.noise<a class="headerlink" href="#module-ipfml.filters.noise" title="Permalink to this headline">¶</a></h1>
  78. <p>Noise filters to apply on images</p>
  79. <p class="rubric">Functions</p>
  80. <table border="1" class="longtable docutils">
  81. <colgroup>
  82. <col width="10%" />
  83. <col width="90%" />
  84. </colgroup>
  85. <tbody valign="top">
  86. <tr class="row-odd"><td><a class="reference internal" href="#ipfml.filters.noise.cauchy_noise" title="ipfml.filters.noise.cauchy_noise"><code class="xref py py-obj docutils literal notranslate"><span class="pre">cauchy_noise</span></code></a>(image,&nbsp;n[,&nbsp;identical,&nbsp;…])</td>
  87. <td>Cauchy noise filter to apply on image</td>
  88. </tr>
  89. <tr class="row-even"><td><a class="reference internal" href="#ipfml.filters.noise.gaussian_noise" title="ipfml.filters.noise.gaussian_noise"><code class="xref py py-obj docutils literal notranslate"><span class="pre">gaussian_noise</span></code></a>(image,&nbsp;n[,&nbsp;identical,&nbsp;…])</td>
  90. <td>Gaussian noise filter to apply on image</td>
  91. </tr>
  92. <tr class="row-odd"><td><a class="reference internal" href="#ipfml.filters.noise.laplace_noise" title="ipfml.filters.noise.laplace_noise"><code class="xref py py-obj docutils literal notranslate"><span class="pre">laplace_noise</span></code></a>(image,&nbsp;n[,&nbsp;identical,&nbsp;…])</td>
  93. <td>Laplace noise filter to apply on image</td>
  94. </tr>
  95. <tr class="row-even"><td><a class="reference internal" href="#ipfml.filters.noise.log_normal_noise" title="ipfml.filters.noise.log_normal_noise"><code class="xref py py-obj docutils literal notranslate"><span class="pre">log_normal_noise</span></code></a>(image,&nbsp;n[,&nbsp;identical,&nbsp;…])</td>
  96. <td>Log-normal noise filter to apply on image</td>
  97. </tr>
  98. <tr class="row-odd"><td><a class="reference internal" href="#ipfml.filters.noise.mut_white_noise" title="ipfml.filters.noise.mut_white_noise"><code class="xref py py-obj docutils literal notranslate"><span class="pre">mut_white_noise</span></code></a>(image,&nbsp;n[,&nbsp;identical,&nbsp;…])</td>
  99. <td>Multiplied White noise filter to apply on image</td>
  100. </tr>
  101. <tr class="row-even"><td><a class="reference internal" href="#ipfml.filters.noise.salt_pepper_noise" title="ipfml.filters.noise.salt_pepper_noise"><code class="xref py py-obj docutils literal notranslate"><span class="pre">salt_pepper_noise</span></code></a>(image,&nbsp;n[,&nbsp;identical,&nbsp;p,&nbsp;k])</td>
  102. <td>Pepper salt noise filter to apply on image</td>
  103. </tr>
  104. <tr class="row-odd"><td><a class="reference internal" href="#ipfml.filters.noise.white_noise" title="ipfml.filters.noise.white_noise"><code class="xref py py-obj docutils literal notranslate"><span class="pre">white_noise</span></code></a>(image,&nbsp;n[,&nbsp;identical,&nbsp;…])</td>
  105. <td>White noise filter to apply on image</td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. <dl class="function">
  110. <dt id="ipfml.filters.noise.cauchy_noise">
  111. <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="reference internal" href="../_modules/ipfml/filters/noise.html#cauchy_noise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ipfml.filters.noise.cauchy_noise" title="Permalink to this definition">¶</a></dt>
  112. <dd><p>Cauchy noise filter to apply on image</p>
  113. <table class="docutils field-list" frame="void" rules="none">
  114. <col class="field-name" />
  115. <col class="field-body" />
  116. <tbody valign="top">
  117. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  118. <li><strong>image</strong> – image used as input (2D or 3D image representation)</li>
  119. <li><strong>n</strong> – used to set importance of noise [1, 999]</li>
  120. <li><strong>identical</strong> – keep or not identical noise distribution for each canal if RGB Image (default False)</li>
  121. <li><strong>distribution_interval</strong> – set the distribution interval of normal law distribution (default (0, 1))</li>
  122. <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.0002)</li>
  123. </ul>
  124. </td>
  125. </tr>
  126. <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>
  127. </td>
  128. </tr>
  129. </tbody>
  130. </table>
  131. <p>Example:</p>
  132. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">ipfml.filters.noise</span> <span class="k">import</span> <span class="n">cauchy_noise</span>
  133. <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
  134. <span class="gp">&gt;&gt;&gt; </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>
  135. <span class="gp">&gt;&gt;&gt; </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>
  136. <span class="gp">&gt;&gt;&gt; </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
  137. <span class="go">(100, 100)</span>
  138. </pre></div>
  139. </div>
  140. </dd></dl>
  141. <dl class="function">
  142. <dt id="ipfml.filters.noise.gaussian_noise">
  143. <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="reference internal" href="../_modules/ipfml/filters/noise.html#gaussian_noise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ipfml.filters.noise.gaussian_noise" title="Permalink to this definition">¶</a></dt>
  144. <dd><p>Gaussian noise filter to apply on image</p>
  145. <table class="docutils field-list" frame="void" rules="none">
  146. <col class="field-name" />
  147. <col class="field-body" />
  148. <tbody valign="top">
  149. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  150. <li><strong>image</strong> – image used as input (2D or 3D image representation)</li>
  151. <li><strong>n</strong> – used to set importance of noise [1, 999]</li>
  152. <li><strong>identical</strong> – keep or not identical noise distribution for each canal if RGB Image (default False)</li>
  153. <li><strong>distribution_interval</strong> – set the distribution interval of normal law distribution (default (0, 1))</li>
  154. <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.1)</li>
  155. </ul>
  156. </td>
  157. </tr>
  158. <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>
  159. </td>
  160. </tr>
  161. </tbody>
  162. </table>
  163. <p>Example:</p>
  164. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">ipfml.filters.noise</span> <span class="k">import</span> <span class="n">gaussian_noise</span>
  165. <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
  166. <span class="gp">&gt;&gt;&gt; </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>
  167. <span class="gp">&gt;&gt;&gt; </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>
  168. <span class="gp">&gt;&gt;&gt; </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
  169. <span class="go">(100, 100)</span>
  170. </pre></div>
  171. </div>
  172. </dd></dl>
  173. <dl class="function">
  174. <dt id="ipfml.filters.noise.laplace_noise">
  175. <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="reference internal" href="../_modules/ipfml/filters/noise.html#laplace_noise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ipfml.filters.noise.laplace_noise" title="Permalink to this definition">¶</a></dt>
  176. <dd><p>Laplace noise filter to apply on image</p>
  177. <table class="docutils field-list" frame="void" rules="none">
  178. <col class="field-name" />
  179. <col class="field-body" />
  180. <tbody valign="top">
  181. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  182. <li><strong>image</strong> – image used as input (2D or 3D image representation)</li>
  183. <li><strong>n</strong> – used to set importance of noise [1, 999]</li>
  184. <li><strong>identical</strong> – keep or not identical noise distribution for each canal if RGB Image (default False)</li>
  185. <li><strong>distribution_interval</strong> – set the distribution interval of normal law distribution (default (0, 1))</li>
  186. <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.1)</li>
  187. </ul>
  188. </td>
  189. </tr>
  190. <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>
  191. </td>
  192. </tr>
  193. </tbody>
  194. </table>
  195. <p>Example:</p>
  196. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">ipfml.filters.noise</span> <span class="k">import</span> <span class="n">laplace_noise</span>
  197. <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
  198. <span class="gp">&gt;&gt;&gt; </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>
  199. <span class="gp">&gt;&gt;&gt; </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>
  200. <span class="gp">&gt;&gt;&gt; </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
  201. <span class="go">(100, 100)</span>
  202. </pre></div>
  203. </div>
  204. </dd></dl>
  205. <dl class="function">
  206. <dt id="ipfml.filters.noise.log_normal_noise">
  207. <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="reference internal" href="../_modules/ipfml/filters/noise.html#log_normal_noise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ipfml.filters.noise.log_normal_noise" title="Permalink to this definition">¶</a></dt>
  208. <dd><p>Log-normal noise filter to apply on image</p>
  209. <table class="docutils field-list" frame="void" rules="none">
  210. <col class="field-name" />
  211. <col class="field-body" />
  212. <tbody valign="top">
  213. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  214. <li><strong>image</strong> – image used as input (2D or 3D image representation)</li>
  215. <li><strong>n</strong> – used to set importance of noise [1, 999]</li>
  216. <li><strong>identical</strong> – keep or not identical noise distribution for each canal if RGB Image (default False)</li>
  217. <li><strong>distribution_interval</strong> – set the distribution interval of normal law distribution (default (0, 1))</li>
  218. <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.05)</li>
  219. </ul>
  220. </td>
  221. </tr>
  222. <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>
  223. </td>
  224. </tr>
  225. </tbody>
  226. </table>
  227. <p>Example:</p>
  228. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </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>
  229. <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
  230. <span class="gp">&gt;&gt;&gt; </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>
  231. <span class="gp">&gt;&gt;&gt; </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>
  232. <span class="gp">&gt;&gt;&gt; </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
  233. <span class="go">(100, 100)</span>
  234. </pre></div>
  235. </div>
  236. </dd></dl>
  237. <dl class="function">
  238. <dt id="ipfml.filters.noise.mut_white_noise">
  239. <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="reference internal" href="../_modules/ipfml/filters/noise.html#mut_white_noise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ipfml.filters.noise.mut_white_noise" title="Permalink to this definition">¶</a></dt>
  240. <dd><p>Multiplied White noise filter to apply on image</p>
  241. <table class="docutils field-list" frame="void" rules="none">
  242. <col class="field-name" />
  243. <col class="field-body" />
  244. <tbody valign="top">
  245. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  246. <li><strong>image</strong> – image used as input (2D or 3D image representation)</li>
  247. <li><strong>n</strong> – used to set importance of noise [1, 999]</li>
  248. <li><strong>identical</strong> – keep or not identical noise distribution for each canal if RGB Image (default False)</li>
  249. <li><strong>distribution_interval</strong> – set the distribution interval of normal law distribution (default (0, 1))</li>
  250. <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.002)</li>
  251. </ul>
  252. </td>
  253. </tr>
  254. <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>
  255. </td>
  256. </tr>
  257. </tbody>
  258. </table>
  259. <p>Example:</p>
  260. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </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>
  261. <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
  262. <span class="gp">&gt;&gt;&gt; </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>
  263. <span class="gp">&gt;&gt;&gt; </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>
  264. <span class="gp">&gt;&gt;&gt; </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
  265. <span class="go">(100, 100)</span>
  266. </pre></div>
  267. </div>
  268. </dd></dl>
  269. <dl class="function">
  270. <dt id="ipfml.filters.noise.salt_pepper_noise">
  271. <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="reference internal" href="../_modules/ipfml/filters/noise.html#salt_pepper_noise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ipfml.filters.noise.salt_pepper_noise" title="Permalink to this definition">¶</a></dt>
  272. <dd><p>Pepper salt noise filter to apply on image</p>
  273. <table class="docutils field-list" frame="void" rules="none">
  274. <col class="field-name" />
  275. <col class="field-body" />
  276. <tbody valign="top">
  277. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  278. <li><strong>image</strong> – image used as input (2D or 3D image representation)</li>
  279. <li><strong>n</strong> – used to set importance of noise [1, 999]</li>
  280. <li><strong>identical</strong> – keep or not identical noise distribution for each canal if RGB Image (default False)</li>
  281. <li><strong>p</strong> – probability to increase pixel value otherwise decrease it</li>
  282. <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.5)</li>
  283. </ul>
  284. </td>
  285. </tr>
  286. <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>
  287. </td>
  288. </tr>
  289. </tbody>
  290. </table>
  291. <p>Example:</p>
  292. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </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>
  293. <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
  294. <span class="gp">&gt;&gt;&gt; </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>
  295. <span class="gp">&gt;&gt;&gt; </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>
  296. <span class="gp">&gt;&gt;&gt; </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
  297. <span class="go">(100, 100)</span>
  298. </pre></div>
  299. </div>
  300. </dd></dl>
  301. <dl class="function">
  302. <dt id="ipfml.filters.noise.white_noise">
  303. <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="reference internal" href="../_modules/ipfml/filters/noise.html#white_noise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ipfml.filters.noise.white_noise" title="Permalink to this definition">¶</a></dt>
  304. <dd><p>White noise filter to apply on image</p>
  305. <table class="docutils field-list" frame="void" rules="none">
  306. <col class="field-name" />
  307. <col class="field-body" />
  308. <tbody valign="top">
  309. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  310. <li><strong>image</strong> – image used as input (2D or 3D image representation)</li>
  311. <li><strong>n</strong> – used to set importance of noise [1, 999]</li>
  312. <li><strong>identical</strong> – keep or not identical noise distribution for each canal if RGB Image (default False)</li>
  313. <li><strong>distribution_interval</strong> – set the distribution interval of normal law distribution (default (-0.5, 0.5))</li>
  314. <li><strong>k</strong> – variable that specifies the amount of noise to be taken into account in the output image (default 0.2)</li>
  315. </ul>
  316. </td>
  317. </tr>
  318. <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>
  319. </td>
  320. </tr>
  321. </tbody>
  322. </table>
  323. <p>Example:</p>
  324. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">ipfml.filters.noise</span> <span class="k">import</span> <span class="n">white_noise</span>
  325. <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
  326. <span class="gp">&gt;&gt;&gt; </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>
  327. <span class="gp">&gt;&gt;&gt; </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>
  328. <span class="gp">&gt;&gt;&gt; </span><span class="n">noisy_image</span><span class="o">.</span><span class="n">shape</span>
  329. <span class="go">(100, 100)</span>
  330. </pre></div>
  331. </div>
  332. </dd></dl>
  333. </div>
  334. </div>
  335. </div>
  336. <footer>
  337. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  338. <a href="ipfml.iqa.fr.html" class="btn btn-neutral float-right" title="ipfml.iqa.fr" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
  339. <a href="ipfml.exceptions.html" class="btn btn-neutral" title="ipfml.exceptions" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
  340. </div>
  341. <hr/>
  342. <div role="contentinfo">
  343. <p>
  344. &copy; Copyright 2019, Jérôme BUISINE
  345. </p>
  346. </div>
  347. 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>.
  348. </footer>
  349. </div>
  350. </div>
  351. </section>
  352. </div>
  353. <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
  354. <script type="text/javascript" src="../_static/jquery.js"></script>
  355. <script type="text/javascript" src="../_static/underscore.js"></script>
  356. <script type="text/javascript" src="../_static/doctools.js"></script>
  357. <script type="text/javascript" src="../_static/language_data.js"></script>
  358. <script type="text/javascript" src="../_static/js/theme.js"></script>
  359. <script type="text/javascript">
  360. jQuery(function () {
  361. SphinxRtdTheme.Navigation.enable(true);
  362. });
  363. </script>
  364. </body>
  365. </html>