BaşlayınÜcretsiz Başlayın

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.

Young woman selfie
Image preloaded as 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.

Bu egzersiz

Image Processing in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Apply superpixel segmentation and obtain the segments a.k.a. labels using slic().
  • Obtain the segmented image using label2rgb(), passing the segments and profile_image.
  • Detect the faces, using the detector with multi scale method.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# 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)
Kodu Düzenle ve Çalıştır