I am working on writing a bit of code to determine the velocity of an object moving in front of a camera. I am wondering if anyone of you has experience determining the real world velocity of something that you captured with a camera. I have information about the conversion between pixels and real world length, as well as the time between frames. Unfortunately, I don't know what role the optical flow values play in this, and how they can be converted to a real world velocity. That's my main question.
Here is the code that I am working with
videoReader = vision.VideoFileReader('VideoInCurrentDirectory.mp4','ImageColorSpace','Intensity');
of = opticalFlowHS;
Vx = zeros(250,400,100);
vidFrame = step(videoReader);
flowField = estimateFlow(of,vidFrame);
flowFieldSimp.Vx = flowField.Vx;
Vx(:,:,i) = flowFieldSimp.Vx;
I can then see the optical flow x direction velocities for each frame in the Vx matrix. But I don't know what to do with those values.
So if any of you can offer help or point to any resources that deal with optical flow and real world velocities, that would be a big help. I have looked at other answers about the units of optical flow from MATLAB, but the answers weren't very clear.