Privacy protection
Let's look at a real-world application of what you have learned in the course.
In this exercise, you will detect human faces in the image and for the sake of privacy, you will anonymize data by blurring people's faces in the image automatically.

group_image
.You can use the gaussian filter for the blurriness.
The face detector is ready to use as detector
and all packages needed have been imported.
Diese Übung ist Teil des Kurses
Image Processing in Python
Anleitung zur Übung
- Detect the faces in the image using the
detector
, set the minimum size of the searching window to 10 by 10 pixels. - Go through each detected face with a for loop.
- Apply a gaussian filter to detect and blur faces, using a sigma of 8.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Detect the faces
detected = ____.____(img=____,
scale_factor=1.2, step_ratio=1,
min_size=____, max_size=(100, 100))
# For each detected face
for d in ____:
# Obtain the face rectangle from detected coordinates
face = getFaceRectangle(d)
# Apply gaussian filter to extracted face
blurred_face = ____(face, multichannel=____, sigma = ____)
# Merge this blurry face to our final image and show it
resulting_image = mergeBlurryFace(group_image, blurred_face)
show_image(resulting_image, "Blurred faces")