Skip to content

Instantly share code, notes, and snippets.

@vallantin
Last active October 8, 2019 18:03
Show Gist options
  • Save vallantin/dc70db99ee2e335d00f2686140080115 to your computer and use it in GitHub Desktop.
Save vallantin/dc70db99ee2e335d00f2686140080115 to your computer and use it in GitHub Desktop.
def find_and_blur(bw, color):
# detect al faces
faces = cascade.detectMultiScale(bw, 1.1, 4)
# get the locations of the faces
for (x, y, w, h) in faces:
# select the areas where the face was found
roi_color = color[y:y+h, x:x+w]
# blur the colored image
blur = cv2.GaussianBlur(roi_color, (101,101), 0)
# Insert ROI back into image
color[y:y+h, x:x+w] = blur
# return the blurred image
return color
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment