Sunday, October 12, 2008

Head Tracker using OpenCV Qt4 and OpenGL

Recently i have heard about ps3 face tracking capability in games. Then i have came across around some videos at youtube regarding this technology. There are many related to OpenCV which is a Image processing library from Intel. So i have written a small Head tracking application using haarcascades in opencv for detecting face and tracking; and Qt4 for the gui; and opengl for rendoring.

Its very imature and lots to improve on.
As for now it wont be able to track if you bend your head too much or turn too much. I need to learn alot about OpenCV and work on this more.

Possibilities by using this can be many. Integrate into a opengl 3dmodel viewer which rotates as you move your head to get a 3dviewing feel :). You can easily control mouse on a PC , so if u can able to write a module which can be integrated into current pc games like Counter Strike :D It would be great :).

Youtube Video link


TooL said...

Awesome application

Anonymous said...


I am very interested to integrate OpenCV, OpenGL, and Qt4. Can you show me your solution?

Thanks a lot.


Vijay Kumar Raju said...

Hi i myself am new to opencv and qt4 .... and the code is not perfect ... i can send u the code if u want

Anonymous said...

hi, very NICE
Can yu make a tutorial how to do this ?
Or can yu send the code?


Vijay Kumar Raju said...

I have sent a mail. check

Ionthas said...

Hi, Vijay.

I'm interested to compile qt4 and openCV at the same time.

Compiler send me an error. How do you have the .pro file?

If it's possible, can you send me your code to

(Sorry for my english)

bye & tnks.

Vijay Kumar Raju said...

sorry dude i just saw the message,
I have sent the code
u can put something like below in *.pro file, (I use linux)
LIBS += -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux -lml

Anonymous said...

hi.. vijay i am working on opencv .. i need to implement the face tracking in opencv so can you please send me your code it might be helpful .....

Vijay Kumar Raju said...

Hi check your mail

Anonymous said...

hi vijay..
i got your mail.. i need to keep track of persons so i tried with the camshift face tracking demo code that's available in the opencv environment but it's working only for one person actually i need to track multiple persons ... Is this possible?

Anonymous said...

hi vijay ..
thank you for sending your code....

Anonymous said...

Nice work.
m new to OpenCV but I also want to study the code.

please send me the code.

Vijay Kumar Raju said...

It should be possible. the facedetect example bundled with the opencv detects all the faces . I removed that because i need to track only one. Just check the facedetect example in opencv.

Vijay Kumar Raju said...

see the examples with opencv. best place to start, I myself learning opencv :D
THis code maybe helpful if u want to integrate opencv with opengl/QtGui instead of the highgui, which comes with opencv.

Vijay Kumar Raju said...

anyway i sent the code, check ur mail said...

I was trying to use wxWidgets, but this looks like a better solution. Could you send me the code too ;-)


Anonymous said...

hi vijay ..
this a manchu ... the face detection code works fine.. it detects all the faces but i want to keep track of more then one person..likewise i want to find out how long the person is sitting in front of the computer and if any new person comes then it should keep track that person also.. can you understand what i mean... so camshift is the only thing available in opencv .. but that works only for one person.. can you please check it out and let me know...

Anonymous said...

hi.. This is manchu..
i need to know how to make the webcam work with the opencv in linux...

Steven said...

Hi !
Nice work integrating all this together !
Could you send me the code as well ?
Thx a lot in advance,


Vijay Kumar Raju said...

Hi steven i dont have any problem in sending the code. Please give ur mail id so i can send

akbay said...


good work. i cant compile eclipse+qt+opencv. could you send me the project.

thanks in advance

Vijay Kumar Raju said...

Hi akbay, give me some mail id so i can send

若尘 said...

I am very interested to integrate OpenCV and QT4.
If it possible, can you send your code to me?

Thanks very much!

Anonymous said...

wow...this is what im lookin for. Im actually trying to learn about Qt4 + openCV. Could you please send me the code to

It would be very helpfull. tnx b4

Vijay Kumar Raju said...

check ur mails

Anonymous said...

hello, i want to see your solution.

please send me the code.

Christian said...

hi, this is a very nice example! congratulations!

can I have your code too?

thanks a lot!

best regards,

nasedo said...

This example is awesome. Could you send me the code to study it? Thank you.

nasedo (at)mail2world(dot) com

Assim said...

Hi Vijay,

I have myself made a head tracking code in OpenCV and Qt. But i am not able to get the video output of opencv in Qt. Can you send your code? Also there are many ppl asking for your code. It would be of great help if you can upload it some where and post out the link.

DiegoCerdan said...

Hi Vijay,

Could you send me the code? I am working on an OpeCV + QT application and your base would be a nice place to start hacking.

Anonymous said...

Hi Vijay,

nice app, I would like to try
it on my laptop, you seem to be willing to share the code ...



Marcilio said...
This comment has been removed by the author.
Marcilio said...


I'm trying hard to integrate Qt and opencv, I know that I have to do something with my .pro, but I haven't found nothin clear in the web. Could you give me a little help please!


my mail:

Anonymous said...

Hi Vijay --

I'm working with OpenCV, OpenGL and Qt and am interested in your source code as well.



Vijay Kumar Raju said...

i have sent the code.
im also uploading it to rapidshare.
Here is the link

Pushkar said...

hey vijay..great stuff..i hav a face tracking project at hand..may b ur code vl prove a help to m...can u please send the code..

the rapidshare link says that the limit to download the file is reached..needs to b updated by the uploader..

please can u send m the code..

thanks a lot..

Srini M said...

Hi Vijay,
Cool stuff! Can you forward the code to me as well?


GaryKnight said...

Nice work. send me to.

anshu said...
This comment has been removed by the author.
anshu said...

hi vijay.
I know it must be tiring for you now to send your code. But I also want that code if you can provide. rapid share link doesn't work.
i am working on a similar application involving hands so i think your work can help me to start. I would be very grateful if you can help me in this regards.
my id is

Chen said...


I'm intrested in integrating OpenCV, Qt and Eclipse, and I'd love to get a small tutorial on how to do so (if you have such a tutorial..)

Thanks a lot!

Anonymous said...

Hi Vijay,

Well done! I would like to request the app. I would be great if you could send it to me, or you might upload it to qt-apps.

Thanks :)

Anonymous said...

Hi, Vijay,

Great job!

I am trying integrating opencv and Qt too. I need to implement some tracking methods, can you send me your code, please?

Thanks a lot in advance,


gerabelo said...


so, have you played CS with something like this? cool! (:

I am trying do the same... using cvMatchTemplate basicly but at Windows, of course. by the way, what opencv's version you have used in this ubuntu video example?

thank you and congratulations!

subayal said...

Hello Vijay,

I have been trying hard to integrate OPENCV and QT in my test application.
Could I please have a look at your code.

my email is


Anonymous said...

Hi I'm having my Finaly Year Project now and am working on this but completely have no clue on how to start. Could you send me your code?


manushyakam said...

Could you please send me your code
really nice effort..
Thanks in advance,

manushyakam said...

sorry just forget to add my mail id

David Peter said...

Hi, Vijay.
I am sorry to bother you, but the rapidshare link doesnt work. I am working on detection, tracking and recognition of faces, but amd also interested in Qt interfaces. Your code would be very interesting! Thanks in advance, here is my email:

Rocco Agostino said...

Hi, great work!!! but file rapidshare is broken!!! can you send me your solution for my problem? my email is
thanks a lot

lam.meng.chun said...

Hello Vijay,

It is a greate job, I'm working on my degree thesis it's is also include head tracking function. Can send me the code if u dun mind.
I would very appreciate on that.

Thanks you

Anonymous said...

Hi Vijay,
I'm researcher in machine vision, and I found your application quite interesting to me. Would you please share the source code? Many thanks!


atrv7 said...

Someone please send me the code, working on automating the spotlight for theatrical performances...

nayan said...

I am working on the tracking project. Can you share me your code? thanks in advance.

Email id:

Anonymous said...

Goodday vijay,

i watched your head tracking demo in youtube. it's such a nice programm. i would like to try your programm for learning purpose. i tried to download from the given rapidshare link but it doesnt seem to work anymore. would u please upload again your source code or if possible u can send the code to my email :

thanx in advance

Anonymous said...

hey! i am learning about opencv and qt and i find your example, rapidshare link dont run... can you send me the source to learn about a master?? :)josegoupm@gmail.comthanks!

Anonymous said...

Hi, this is great start up application. Congratulate!
Can u send me source code, please?

Anonymous said...

Hello, I study QT on Beagleboard and this is great. Could you send me source code? Thank you very much :)

Anonymous said...

I am curious how you mixed IplImages with Qt-OpenGL, could you send me code to or post it on github or sth ?

Anonymous said...

Hey, It appears as if your download link. Would really appreciate it if you could send the source to



Anonymous said...


I want to do a project that is related to tracking. I have see you video about "head tracker using OpenCVQt4 and OpenGL" and I would like to send me if it is possible your code at ,

Anonymous said...

Hello man.. can u please send me that code?

Robson said...


I am very interested to integrate OpenCV, OpenGL, and Qt4. Can you show me your solution?

Thanks a lot.

Anonymous said...

hi, i try to integrate facedetect from samples in qt4 but i still no find a solution.
i see your video demo, great work!!

can you email me the code?

thank's advantage

Anonymous said...

Hi Vijay,

I tried to download the file from rapid share but the file that comes down is just a compressed index page.

Could you repost the code?


Apinan said...

Hi Vijay,

I'm trying to to head tracking with OpenCV on Qt too, and I'm having some problem with it.

It's be really great if you'd send me your code as a sample.

Please upload/mail it to apinand.d (a t)

Thank you so much.

nofortee said...

Hi, I was wondering whether you still kept the code?

I have been working on a qt, opencv and opengl right now. It would be great if I can get the sample code.


Anonymous said...


Great integration of OpenCV and Qt. I'd love to have a look at your code if you still have a copy of it (to be honest I'm pretty lost with connecting the two for video playback in Linux).


Josep said...

Hi Vijay Kumar,
I'm developing my school project and your app source code could be very usefull to me.
Rapidshare link doesnt't work.
Can you sent me source code please??

Thanks in advance!

ouazar.yahia said...

can you send me the code please.

guerrerodeluz11 said...

hey buddy i have a qt4 opencv source code to display webcam video can you send to my email your head tracing code??it seems the rapidshare link isnt working...

my mail is

Cherva said...

Hi Vijay, can you send me your code at ? Thanks.

Rainer said...

I am interested in you code too - can you please send it to me

Anonymous said...

Hi vijay,
i am working on omap3530 devkit8000 i need to complie opencv for the above target i need your help.. can u please mail me your contact number or any messanger id to me..
my id

Polina V. said...

Hi Vijay!

I am working on beaglebone right now (TI user up there ftw), and I am trying to use OPENGL functionality for my GUI. I would be really interested in seeing your code for reference, if of course you are giving it out.

PS: Impressive work, way to go!

Major thanks,
Polina V

Anonymous said...

interesting and good work,can you share your code.....Thank you.

David Lee said...

I'm kind of new to opencv. I found your blog interesting. If you could share your code, it would be very helpful for me to learn opencv.
kind regards,

David Lee said...
This comment has been removed by the author.