ipfml.filters.noise.html 30 KB

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