Segmentation and face detection
Previously, you learned how to make processes more computationally efficient with unsupervised superpixel segmentation. In this exercise, you'll do just that!
Using the slic()
function for segmentation, pre-process the image before passing it to the face detector.

profile_image
.The Cascade
class, the slic()
function from segmentation
module, and the show_detected_face()
function for visualization have already been imported. The detector is already initialized and ready to use as detector
.
Diese Übung ist Teil des Kurses
Image Processing in Python
Anleitung zur Übung
- Apply superpixel segmentation and obtain the segments a.k.a. labels using
slic()
. - Obtain the segmented image using
label2rgb()
, passing thesegments
andprofile_image
. - Detect the faces, using the detector with multi scale method.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Obtain the segmentation with default 100 regions
segments = ____
# Obtain segmented image using label2rgb
segmented_image = ____(____, ____, kind='avg')
# Detect the faces with multi scale method
detected = detector.____(img=____,
scale_factor=1.2,
step_ratio=1,
min_size=(10, 10), max_size=(1000, 1000))
# Show the detected faces
show_detected_face(segmented_image, detected)