Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

So, I'm toying around with an augmented reality game. I'm using computer vision to track a particular object, which works reasonably well. I'm trying to animate something that basically follows that object around on screen.

This has proven pretty hard. The tracked location of the object is very jittery. I've tried to smooth it out by setting a threshold under which we don't bother moving the sprite, but this leads to jumpy animation rather than jittery. I want the sprite to follow the tracked object in close to real time, so aggregating movement over a lot of frames to get smooth results isn't a great option for me.

Are there any techniques I could use in this case that might help smooth things out?

share|improve this question
    
I find this problem hard to visualize. It's not clear exactly what follow pattern you want, or why the solutions you have tried doesn't work. A piece of code, a working demo or a video might shed some light on the problem. –  eBusiness Dec 15 '11 at 19:01
    
Can you maybe link to a video showing the kind of movement you’re tracking? –  Sam Hocevar Dec 15 '11 at 21:13
add comment

1 Answer

Springs using Hooke's Law can help here, they are basically a low-pass filter, filtering out the high frequency jittering. One end of the spring is connected to the following object, the other end is connected to its (jittering) target position.

Here is a gafferongames article about them.


A simpler solution might be to use an easing function to make the object follow the jittering target-position smoother.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.