.. _example_plot_rank_mean.py:


============
Mean filters
============

This example compares the following mean filters of the rank filter package:

 * **local mean**: all pixels belonging to the structuring element to compute
   average gray level.
 * **percentile mean**: only use values between percentiles p0 and p1
   (here 10% and 90%).
 * **bilateral mean**: only use pixels of the structuring element having a gray
   level situated inside g-s0 and g+s1 (here g-500 and g+500)

Percentile and usual mean give here similar results, these filters smooth the
complete image (background and details). Bilateral mean exhibits a high
filtering rate for continuous area (i.e. background) while higher image
frequencies remain untouched.


.. image:: images/plot_rank_mean_1.png
    :align: center


.. literalinclude:: plot_rank_mean.py
    :lines: 21-



**Python source code:** :download:`download <plot_rank_mean.py>`
(generated using ``skimage`` |version|)



**IPython Notebook:** :download:`download <./notebook/plot_rank_mean.ipynb>`
(generated using ``skimage`` |version|)

