.. _example_cluster_plot_face_segmentation.py: =================================================== Segmenting the picture of a raccoon face in regions =================================================== This example uses :ref:`spectral_clustering` on a graph created from voxel-to-voxel difference on an image to break this image into multiple partly-homogeneous regions. This procedure (spectral clustering on an image) is an efficient approximate solution for finding normalized graph cuts. There are two options to assign labels: * with 'kmeans' spectral clustering will cluster samples in the embedding space using a kmeans algorithm * whereas 'discrete' will iteratively search for the closest partition space to the embedding space. .. rst-class:: horizontal * .. image:: images/\plot_face_segmentation_001.png :scale: 47 * .. image:: images/\plot_face_segmentation_002.png :scale: 47 **Script output**:: Spectral clustering: kmeans, 15.17s Spectral clustering: discretize, 11.68s **Python source code:** :download:`plot_face_segmentation.py ` .. literalinclude:: plot_face_segmentation.py :lines: 20- **Total running time of the example:** 29.08 seconds ( 0 minutes 29.08 seconds)