LoslegenKostenlos loslegen

Is someone there?

In this exercise, you will check whether or not there is a person present in an image taken at night.

LAndscape of starry night with a young man in the left bottom corner
Image preloaded as night_image.

The Cascade of classifiers class from feature module has been already imported. The same is true for the show_detected_face() function, that is used to display the face marked in the image and crop so it can be shown separately.

Diese Übung ist Teil des Kurses

Image Processing in Python

Kurs anzeigen

Anleitung zur Übung

  • Load the trained file from the data module.
  • Initialize the detector cascade with the trained file.
  • Detect the faces in the image, setting the minimum size of the searching window to 10 pixels and 200 pixels for the maximum.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Load the trained file from data
trained_file = ____.lbp_frontal_face_cascade_filename()

# Initialize the detector cascade
detector = ____(____)

# Detect faces with min and max size of searching window
detected = detector.detect_multi_scale(img = night_image,
                                       scale_factor=1.2,
                                       step_ratio=1,
                                       min_size=(____),
                                       max_size=(____))

# Show the detected faces
show_detected_face(night_image, detected)
Code bearbeiten und ausführen