Hi all,
I’m trying to use the opencv function CalcOpticalFlowLK but am getting a crash and can’t find why.
I started with the zip supplied here http://forum.openframeworks.cc/t/movement-vector-from-video/555/6
which takes input from the camera, converts to greyscale, differences with prev frame etc.
I modified the VectorField class to have 2x linear arrays, u & v to store the horizontal and vertical values (instead of a 2 dimensional array of ofxVec2f) - tested it and worked fine - so no problems there.
Then in the update function I replaced the convertMotionHistoryToField function with the opticalflow function of opencv, making my update function:
camera.grabFrame();
prev = grey;
color.setFromPixels(camera.getPixels(), camera.width, camera.height);
color.blur(15);
color.mirror(false, true);
grey = color;
cvCalcOpticalFlowLK(grey.getCvImage()->imageData, prev.getCvImage()->imageData, cvSize, motionField.u, motionField.v);
From what i can figure by looking around this should be correct, but I get a crash straight away with no useful info in the crash log… does anyone have any ideas what it could be?
(I’m on mac)