Superpixel segmentation
In this exercise, you will apply unsupervised segmentation to the same image, before it's passed to a face detection machine learning model.
So you will reduce this image from \(265 \times 191 = 50,615\) pixels down to \(400\) regions.

face_image
.The show_image()
function has been preloaded for you as well.
Diese Übung ist Teil des Kurses
Image Processing in Python
Anleitung zur Übung
- Import the
slic()
function from thesegmentation
module. - Import the
label2rgb()
function from thecolor
module. - Obtain the segmentation with 400 regions using
slic()
. - Put segments on top of original image to compare with
label2rgb()
.
Interaktive Übung zum Anfassen
Probieren Sie diese Übung aus, indem Sie diesen Beispielcode ausführen.
# Import the slic function from segmentation module
from skimage.____ import ____
# Import the label2rgb function from color module
from skimage.____ import ____
# Obtain the segmentation with 400 regions
segments = ____(____, ____= ____)
# Put segments on top of original image to compare
segmented_image = ____(____, ____, kind='avg')
# Show the segmented image
show_image(segmented_image, "Segmented image, 400 superpixels")