1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Eye Tracking using CAMShift

Discussion in 'C' started by kingfisher, Feb 3, 2009.

  1. kingfisher

    kingfisher New Member

    Joined:
    Feb 2, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     

Share This Page