Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Eye Tracking using CAMShift (http://www.go4expert.com/forums/eye-tracking-using-camshift-t16036/)

 kingfisher 3Feb2009 06:40

Eye Tracking using CAMShift

Hi,

I am currently doing a project on Eye tracking via internet camera, however, I am almost a newbie to C++. (The last time I touched it was abt 7-8 yrs ago)

I am able to track the eyeball using the CAMShift program, but I will need to determine the direction and distance the eyeball moved from its last location. Appreciate if the experts here can help.

Thks.

 xpi0t0s 3Feb2009 13:23

Re: Eye Tracking using CAMShift

If you know the previous position then you can calculate both, e.g. if old position was 10,10 and new position is 20,20, then it's moved 10*sqrt(2) units north-east. The distance is calculated with Pythagoras: sqrt( (newx-oldx)^2 + (newy-oldy)^2 ) and the direction can be worked out either with triangle geometry (watch out for dividing by zero!) or subtracting new from old and checking if the result is negative, zero or positive.

Essentially this is nothing more than a rectangular to polar conversion: x,y -> r,theta.

 All times are GMT +5.5. The time now is 09:26.