FaceTracker

Posted on 27/02/2011 by rogue
Modified on: 13/09/2018
Project
Press to mark as completed
Introduction
This is an automatic import from our previous community platform. Some things can look imperfect.

If you are the original author, please access your User Control Panel and update it.

This is my first time using OpenCV, an open source computer vision library developed by Intel Corporation.  It wasn't too hard to get setup or use OpenCV in Microsoft Visual Studio 2008 Professional (I haven't tried it with the free Express version of Visual Studio).  I used this link to get started with OpenCV 2.1 (I had problems configuring OpenCV2.2). Hardware: LynxMotion pan and tilt kit with Hitec HS-422 servo motorsCreative USB webcamera, stripped from its caseAtmel AVR ATmega328P ...


FaceTracker

This is my first time using OpenCV, an open source computer vision library developed by Intel Corporation.  It wasn't too hard to get setup or use OpenCV in Microsoft Visual Studio 2008 Professional (I haven't tried it with the free Express version of Visual Studio).  I used this link to get started with OpenCV 2.1 (I had problems configuring OpenCV2.2).

Hardware:

  • LynxMotion pan and tilt kit with Hitec HS-422 servo motors
  • Creative USB webcamera, stripped from its case
  • Atmel AVR ATmega328P microcontroller programmed using AVR Studio 4, AVR GCC, and programmed with an AVRISP MKII
  • A very cheap USB to serial converter (shown in the last image) bought from dealextreme.com.  This actually turned out to be a USB to inverted UART converter.  I inverted the signal using a transistor inverter circuit as shown on the breadboard near where the ribbon cable connects.

The basic operation goes something like this:

  1. Computer fetches an image frame from the USB webcam
  2. Program rotates the image 90 degrees (I mounted the camera sideways)
  3. A face recognition algorithm is applied to the image using OpenCV libraries
  4. When a face is found the pixel coordinates of its center are subtracted from the pixel coordinates of the center of the image.  This results in x and y difference values that can be either negative, positive, or zero if equal.
  5. Serial commands are sent from the computer COM port to the AVR microcontroller corresponding to the direction (sign of x and y difference values) and magnitude of the x and y difference values.
  6. The AVR microcontroller recieves the serial commands from the computer which changes the servo position(s).

My goal is to eventually deploy this on a mobile robot with a WiFi webcam to replace the USB webcam and a Bluetooth serial link to replace the wired serial connection, but first I have to drop the cash on a WiFi webcam.  Otherwise I may go down the road of using a full blown computer on the robot itself.

Code can be found at my sourceforge page under the folder Face Tracker.

Will update with a video in the near future!

*Click to enlarge

Tracks human faces using a webcamera and two servo motors to pan and tilt

  • Actuators / output devices: 2 x Hitec HS-422 servo motors
  • Control method: autonomous
  • CPU: AVR ATmega328P, Core 2 Duo 2.66GHz
  • Operating system: Windows 7 x64
  • Power source: 6 x AA rechargeable batteries (regulated)
  • Programming language: C (microcontroller), C++ w/ OpenCV (computer)
  • Sensors / input devices: Creative USB webcam
  • Target environment: Indoor or outdoor
LikedLike this to see more

Spread the word

Flag this post

Thanks for helping to keep our community civil!


Notify staff privately
It's Spam
This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.

You flagged this as spam. Undo flag.Flag Post