Direction of motion sensing

Hey, I’m trying to be able to discern direction of motion in video, basically I want to know if stuff is moving left to right, or right to left. This is something I was able to do successfully using a flow field in Processing as outlined here: http://www.jackkalish.com/blog/?p=5

I was able to implement the ofxCvOpticalFlowPyrLK add on, as you can see here: http://www.jackkalish.com/blog/?p=51

However, I’m not sure how to use this class to get the general direction of motion. Anyone have any ideas?

Kyle, I also downloaded your ofxCv flow example:
https://github.com/kylemcdonald/ofxCv/tree/master/example-flow

But, I’m having problems getting that to compile.

Thanks,
Jack

Hey, in the ofxCv flow example you could call ‘farneback.getAverageFlow()’. Or if your using the ofxCvOpticalFlowPyrLK addon, you could call ‘averageFlowInRegion(float x, float y, float w, float h)’, just pass in the screen/image dimensions.

I can’t make the example-flow work either.
I deleted the UI addon that was causing errors but now I 'm told that opencv.hpp is missing. I tried to download the last version of opencv, then added the framework to the sources but errors remain.
Thanks for any help.