.. _example_plot_peak_local_max.py:


====================
Finding local maxima
====================

The ``peak_local_max`` function returns the coordinates of local peaks (maxima)
in an image. A maximum filter is used for finding local maxima. This operation
dilates the original image and merges neighboring local maxima closer than the
size of the dilation. Locations where the original image is equal to the
dilated image are returned as local maxima.


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


.. literalinclude:: plot_peak_local_max.py
    :lines: 13-



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



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

