Perhaps my question is a bit too general, but I wonder how to implement optical flow with Ofelia.
I do not know a lot about optical flow, but I looked at some Open Frameworks code and video examples.
If I understand it right it seems possible to implement it with shaders (without openCV).
Here is an example that uses a chain of 4 shaders for calculating optical flow. It could be portable to Ofelia:
https://github.com/princemio/ofxMIOFlowGLSL
And here is another Open Frameworks addon that creates fluid simulation with optical flow. The results are really great, but for now it seems too complex for me to understand and implement it:
Does anyone have any suggestions or different Open Frameworks example code for programming optical flow with Ofelia?
-
Ofelia and optical flow
-
Here is an example that looks easier to implement (it uses only one shader):
http://cs.brown.edu/courses/csci1290/2011/results/final/psastras/ -
No luck so far with implementing any of the optical flow examples. But I took a look at geometry shaders that seem to create the optical flow arrows: https://github.com/moostrik/ofxFlowTools/blob/master/src/core/visualization/shaders/ftVelocityFieldShader.h
And I created a simple motion detection patch that works with a shader and could be a start . The patch works with ofelia 3.0 (@cuinjune thanks for the update) and the patches made for ofelia 2.x need to be edited a bit for working with ofelia 3.x : The set from the ofelia object is now __set and pdCanvas / pdClock is now ofCancas / ofClock:
ofeliaMotionDetection.zip