Blog.phpwnage  
Blog.phpwnage > Compiz Webcam Headtracking A blog by Kevin Lange, UIUC Class of 2013
  Compiz Webcam Headtracking Feb 1, 2009 - klange  
 

(Planet readers, click here)
forum image


Quite a bit of work went into making this, but I'll keep this post short. I wrote the original headtracking plugin a while back to use a Wiimote (and we still have some limited support for one). About a year ago, another developer extended it to use webcam tracking via OpenCV. It still had some bugs and no one really touched it for quite a bit of time. Until now. I made a number of big changes to the code to make things smoother and faster, and more configurable, and it works great with my Mini.

Basically, we're taking data from the camera, piping it through OpenCV to do facetracking (which is taken directly from the sample application provided with OpenCV), pushing that data back into Compiz, doing some trig on it to find a 3d position for our face, and then warping Compiz's OpenGL viewport with glFrustrum. The end result is a rather nice 3d desktop that actually works. We also make windows stack based on their z-depth, so we can look behind them. There are a number of bugs and the thing is still very glitchy, but it works well enough to be somewhat useful. Hopefully we'll get a few more things fixed up later on.


Discuss this news post here.
(15 comments)
 
  Comment on this Article  
 
klange It means your tracking coordinates aren't calibrated and you are in serious need of changes to the values in CCSM before you continue.
Guest ok, i was able to compile and install the plugin, but activating it i loose control of my mouse and i get a lot of artfacts pressing some "key bindings" for rotating the cube.
this mean that my webcam is not opencv compliant or the plugin is still too much unstable?

thank you for your patience
Guest ok man thank you a lot, today i'll test and make you updated
klange @ last poster: You absolutely need OpenCV from SVN. The packages shipped in distributions are so old that they lack a number of important functions.
Guest hi klange,

i've installed opencv (libcvaux-dev libcv-dev python-opencv) and the code is just cloned by the git repository, but i've still one error during make process:

compiling : facedetect.c -> build/facedetect.lofacedetect.c: In function ‘headtrackThread’:
facedetect.c:264: error: too many arguments to function ‘cvRetrieveFrame’
facedetect.c: In function ‘detect’:
facedetect.c:327: error: ‘CV_HAAR_FIND_BIGGEST_OBJECT’ undeclared (first use in this function)
facedetect.c:327: error: (Each undeclared identifier is reported only once
facedetect.c:327: error: for each function it appears in.)
make: *** [build/facedetect.lo] Error 1

could you help me? thank you in advance for your support.
Guest @klange
http://compiz-fusion-icons.googlecode.com/svn/trunk/plugin-headtracking.svg :)
klange You need to have OpenCV, and you need to get the SVN trunk and compile it manually, no other version will work.
Guest Great job!! really!! i heard about this plugin since the time of Johnny Chung Lee video.
Man i tried to grab it from git and compiling it, but it fails giving me some errors about some implicit declared functions such as CV_TERMCRIT_EPS, CV_LKFLOW_PYR_A_READY, CV_SWAP and something like that: "facedetect.c:404: error: request for member ‘x’ in something not a structure or union"

i tried on a debian lenny with 2.6.26 debian kernel, with a git cloned compiz fusion working below, could you give me some hints, i really would to try that.
thank you in advance
klange Should. This is on a 1.3MP integrated webcam, and even then I'm downscaling by a factor of 4 before tracking.
Guest thats...amazing. Would this work with any webcam?
(More Comments)
 
(C) 2010 Kevin Lange [ RSS ][ Mobile ][ PHPwnage ][ PHP 5 ]