Using a velocity vector?

Hi, i am working on a project in which the viewers can navigate through the pages of a sketchbook with their face. I simply mapped the face position to the image sequence index, and it works, but what i want to do is simply use the motion vector as source and a video of the images flipping. How can i get the velocity of the face rect and bind it to the , for example the time of a video?

here is a simple example:

thanks in advance -)

the velocity vector is how much it has moved since the previews frame.
You need to store the previous position and calc the difference, something like

//x = currentPosition  
//y = currentPosition  
ofPoint velocity(x - oldX, y - oldY);  
oldX = x;  
oldY = y;  

If you want to know the amount of movement you have to calculate the distance of the vector

float dist = sqrt(velocity.x*velocity.x + velocity.y*velocity.y);  

now its up to you what to do with that number, maybe trigger a video if its bigger than a certain amount.

hope it helps


Thanks a lot, this is a really good start.