Skip to content

u1i/realtime-face-recognition-webcam-osx

Repository files navigation

Face Detection Photo Booth

A facial anaylysis camera that shows age, gender of a person, highlights eyes and nose on the face and makes a guess about the emotional expression of the person - in (almost) real time!

What it does

  • captures images from your webcam, one each second
  • uses a neural network on the cloud to analyze the face - age, gender, emotion, landmarks
  • adds the information to the image and displays it

Some more technical details

  • image capturing: there's many ways to do that, you can also use ffmpeg to do the task, I've also experimented with Droidcam (Android phone). Anything that gets you a constant stream of JPGs will do.
  • OSX is not Linux. Setting up Python and ImageMagick might be a bit trickier there.
  • ImageMagick needs fonts, they don't always work right away on OSX. See this link here how to fix it
  • image rendering is done in a separate shell-script. Once I figure out how to get the ImageMagick bindings working on Python/OSX we can combine this into one. Probably also a good idea to explore doing this with containers
  • index.html is a very basic page that uses JavaScript (not my strong side) to reload the images every second. Does it well enough but this could be done much nicer I guess.
  • this is really meant as a demo / prototype to show the concept. In a real solution you'd want a real time video stream, where the information is rendered into it using JavaScript. Help me to make this better!

Requirememts

  • MacBook with a Python environment. Libraries: requests, json
  • ImageMagick (via brew)
  • Azure Face API subscription
  • imagesnap

How to use this demo

  1. Install imagesnap and ImageMagick - using brew
  2. Get an Azure subscription for the Cognitive Services Face API and add it to the file analyze_face.py
  3. open a terminal and run ./capture.sh in there
  4. it's your choice which webserver you want to have, here we're using a simple Python wrapper, you can run ./start_server.sh in a second terminal window (I run both commands in the same window using screen
  5. open http://localhost:8080 and try it out!

About

Get instant face detection (gender, age, emotion etc.) of your face from your OSX iSight camera

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published