2012-12-11

Face tracking robot

Android 4.0 introduced an API for face detection. It's really simple to use, you only have to set up a listener and it gets called each time a face is detected in the frame captured by the camera. I used it to make a Lego Mindstorms NXT robot that turns to look at you as you move around. Here's what it looks like:



The way it works is there's an application on the phone that checks if a face is detected. Then it communicates with the robot over Bluetooth and tells it to turn left or right, depending on the position of the face in the frame. Here's the application's source code if you want to take a look. I don't have building plans for the robot itself, but any robot with tank-like steering would work.

A cool way to demo this robot would be to use it for video chats or Google+ hangouts, but I don't think there's a way for two different applications to access the camera at the same time, so the face tracking functionality would have to be integrated into a video chat app. (Or I guess I could put a second phone on the robot.)



14 comments:

  1. You need something that would consume the video stream and split it into two new separate streams that could be used by two applications.

    I'm not familiar with Android but it is definitely possible under Linux.

    ReplyDelete
  2. Hi, i wanna ask you something. How your phone comunicate with your robot ? I mean i don't see any cables in there.

    ReplyDelete
    Replies
    1. The phone talks to the robot over Bluetooth.

      Delete
  3. PLZ‧‧‧‧‧hlep i'm install your APK...but it can't not run。

    ReplyDelete
  4. Hello, i tried running this on a nexus 7 2013, that is running android 4.4.2. The app crashes. Any idea why? Trying to troubleshoot

    ReplyDelete
    Replies
    1. Some devices might not support face detection as it's hardware dependent, but I'm not sure if it would crash the app or just not detect any faces. Can you check logcat to see if there's any error message or stack trace?

      Delete
    2. Hello, this is the log.

      https://www.dropbox.com/s/hi2j9exq02j9ioj/log.txt?dl=0

      Delete
    3. Do you have Bluetooth disabled by any chance?

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. how to install your aplication(.apk)

    ReplyDelete
  7. hello sir can I get your email address please?

    ReplyDelete
  8. Dear Jacek,

    I watch your youtube video about your face tracking robot which looks very good.
    I wonder our you can send me the app for my android smartphone, I want to try it in combinatoin with arduino.

    Please can you send me the app, I will be very thankfull.

    With kind regards,

    Ned (nedstar@live.nl)

    ReplyDelete
  9. Nice bot. But if you wanna use something more discreet, you should check on spytomobile application.

    ReplyDelete