.. _example_edges_plot_convex_hull.py:


===========
Convex Hull
===========

The convex hull of a binary image is the set of pixels included in the
smallest convex polygon that surround all white pixels in the input.

In this example, we show how the input pixels (white) get filled in by the
convex hull (white and grey).

A good overview of the algorithm is given on `Steve Eddin's blog
<http://blogs.mathworks.com/steve/2011/10/04/binary-image-convex-hull-algorithm-notes/>`__.


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


.. literalinclude:: plot_convex_hull.py
    :lines: 16-



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



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

