Headtracking

due to some boredom, i threw together a small exaple how to use opencv and panda together to create a small application based on face-detection/head-tracking. it’s a bit jerky but works.

http://home.arcor.de/positiveelectron/files/Ball-in-Maze-headtracking.zip
you need to have the opencv-python installed to run it.
some people have issues even though they have it installed, looks like some strange version-problem in opencv itself.
i have not tested the code that much, it should run thought.

i made a small screencap from the app running so you can get an idea bout that thing even if it doesnt work for you.
http://www.youtube.com/watch?v=_4N2_530xss

technical info: opencv and panda are running in seperate processes communicating via sockets. so if you have dualcore you’r lucky cause one core does the opencv tracking while the other one runs panda.
since there is no smoothing of the tracking data a well-lit room and a webcam with good fps is recommended or else it will be really jerky.

That’s great. I planned to make a similar one with opencv to make a pong game with a table-tennis racket…

thankyou Thomas - always cool inspiration came from there
by the way I’d to change a line in facedetect.py
from this:

002    from opencv import *

to this:

002    from opencv.cv import *

and comment out this one:

191    self.process  = popen2("gnome-terminal -x python ./facedetect.py")

from Tut-Ball-in-Maze.py and launch facedetect.py from a console cos I’m on kubuntu I guess but that’s not a problem

EDIT
I forgot to say - for the records - that I installed the latest opencv release from sourceforge and plus I had issues installing it 'cos since I’m on AMD mobo and the default installer configuration is settled to use intel SSE2 therefore I’d to launch configure like this:

./configure --disable-sse2

Wow, this is cool. By inverting the axes I was able to tilt the board by tilting my laptop while keeping my head still.

@astelix: Use the one from the Ubuntu repositories instead (python-opencv package).

heh I had it before but Thomas’ script gave me errors so I take for grated he was using a new opencv release and so I installed it. Anyway now it’s all ok.

cool, i have to take a look into…

this is a powerful tracker, have you heard about it?
seeingmachines.com/product/f … downloads/

i heared about it. it was used with panda already. but its non-free so i had no further intrest.
a, from my point of view, more intresting projects it this one
http://code.google.com/p/ehci/ since it offeres full 6DOF headtracking. also comes with a panda-sample :slight_smile:

yeah, this project looks pretty good so far!!!
after i fixed my maya problems, i hope i will find time to play a bit around with the tracker.
btw. you can use a none commercial licence of the faceAPI.

jeah non-comercial ones… which limits you to:6DOF head tracking.
which is pretty much the same as the google-project too. no eyebrows, no mouth no nothing comes with the non-commercial license. + it prevents you to write commercial applications.

maybe the inspirations? and to play a bit around…

often its useful to see how otherones are doing there things and it could bring you on different ideas.

its like the game with the wheel and a wing, in the meantime we nearby are touching other planets with hands. the thoughts are getting bigger…

so im happy when i can take a look into a otherones cookbook, but sure i can understand you, if you know there are so many othergreat points in. it makes you sad that you cant see everything.but thats the trading game, noidea where this will lead us :frowning: hope not into my bad imaginations.

so salute! tracking really rocks!

Sorry to resurrect this post, I am trying to get this working… and I cant seem to find the right python-opencv package. I am using panda 1.6.2, windows XP.

What version of opencv is needed for this? Has anyone tried opencv v.2 ?

Panda is python 2.5 right?

If yes, can anyone provide a link for me to d/l it?

Can check on this one:
discourse.panda3d.org/viewtopic.php?t=6548
It has the required opencv links.

hmm… I already tried with this package…

and I get the following error :

Sizes of input arguments do not match() in function cvCvtColour

from openCV.

Was it meant to work with OpenCV version 0.8 ?

version 0.8 ? I believe it is better to use 1.1.

Dude, ur link has only version 0.8 :slight_smile: or am I blind?

anyone got opencv-python package 1.1?

The ctypes wrapper version is 0.8, opencv version has to be 1.1.

that’s amazing ! , thanks very much :smiley:

i get a error:

DirectStart: Starting the game.
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:display:windisplay(warning): SetForegroundWindow() failed!
Traceback (most recent call last):
File “Tut-Ball-in-Maze.py”, line 27, in
from opencv import *
ImportError: No module named opencv

**** End of process output ****

i saved opencv.1.1pre1 to program files, do i have to save it to the panda3d folder and rename it to opencv? I tried it and it wouldn’t work
any ideas?

dunno if you need to copy anything around. in my case the linux package management took care of that. may help on windows,tho.
this is more a opencv-install issue i guess. i dont really know enough to help you with that.

Due to the extensive changes in the opencv api, this example no longer works. I can at least get it to open by changing

from opencv import * 

to

from cv2 import * 

and commenting out

from cv.highgui import * 

but that last “fix” prevents the head tracking from functioning. Is there a work-around for this that anyone
is aware of?