Skip to content

Instantly share code, notes, and snippets.

@vallantin
Created October 8, 2019 18:19
Show Gist options
  • Save vallantin/eb6244064fd92959f5e215794b1728f5 to your computer and use it in GitHub Desktop.
Save vallantin/eb6244064fd92959f5e215794b1728f5 to your computer and use it in GitHub Desktop.
# turn camera on
video_capture = cv2.VideoCapture(0)
while True:
# get last recorded frame
_, color = video_capture.read()
# transform color -> grayscale
bw = cv2.cvtColor(color, cv2.COLOR_BGR2GRAY)
# detect the face and blur it
blur = find_and_blur(bw, color)
# display output
cv2.imshow('Video', blur)
# break if q is pressed
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# turn camera off
video_capture.release()
# close camera window
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment