OpenHeadTrack
A ported implementation of Johnny Lee's Head Tracking /w OpenGL and OpenCV for Windows (C# OpenTK / Emgu), and Android (not using face detection)

The same code is ported to both platforms so it's also easy to learn OpenGL on different platforms. The code also teaches you how to get a camera feed into a GL texture and use head tracking algorithms on it with OpenCV.

Works with webcam!

(Will) work with Kinect or accelerometer!
 

A bit about the Android version

Unfortunately, I couldn't get OpenCV to run alongside my OpenGL implementation (using GLSurfaceView). Setting up face detection and head tracking is pretty straightforward using either the native Android face detection API or OpenCV implementation. You can show the camera preview and detect head movement and faces.

Running the GL renderer alongside the face detection code (on a different thread) didn't seem to work for me. If anyone can take a look at the code and fix it it'd be great (I removed Sample2View and SampleCvViewBase into the project from the Android OpenCV Webcam sample).

Currently, I found on the internet an implementation of OpenCV using OpenGL ES 2.0 on Android, which would work.

But I implemented everything in OpenGL 1.0 so it will take some time to port it again to ES 2.0 for it to work.

If anyone is up for the job, the code is on the site.

Instead of using face detection, I decided to use the accelerometer and magnetic sensor to change the perspective on the view.

 

Currently Windows and Android source codes are available.

HeadTracking OpenGL for Android


What you'll need before building for Windows


What you'll need before building for iPhone

  • Check out this tutorial on how to build an OpenCV framework for iOS.

 

I observed code from these developers (whom I wish to take this opportunity to thank!):

Windows

  • Johnny Chung Lee

Head Tracking for Desktop VR using Wii Remote (DirectX / Wii / C#)

  • Luka Del Tongo

Emgu CV Head Movement Direction Tutorial (OpenCV Head Tracking / Webcam / C#)

  • Steven Snyder

Wiimote Headtracking (OpenGL / Wii / C++)

  • Head3D -

http://head3d.codeplex.com/ (WPF 3D / Wii / Kinect / C#)

Android

  • Niels Henze's random stuff -

Showing camera images with OpenGL on Android example (Android OpenGL / Webcam)

Text rendering with Android and OpenGL.

Getting tilt data on Android phones.

 

iOS

  • www.aptogo.co.uk -

Computer vision with iOS Part 1: Building an OpenCV framework

Computer vision with iOS Part 2: Face tracking in live video

 

Plans for near future:

  • Add Kinect support
  • Port to iPhone


Help Wanted
If anyone wants to contribute I'll be very happy to help in any way.
For instance, I'm sure there's a better way for OpenGL text rendering than what I used. And I'm sure that with ideas from more people we can add different cool features! :)

Last edited May 31, 2012 at 11:33 AM by RoyDev, version 44