Restrict flow field to horizontal disparity
Hello,
I was wondering if any of the flow field implementations in OpenCV can be restricted to only allow disparity along the horizontal axis.
Background: I know which linear movements are occurring and I only want to measure disparity along this axis.
If not, any hints on how such a feature could be implemented would be highly appreciate.
Well, you can simply ignore the y components. With farneback, just split the flow matrix into two channels and drop the second.
Thanks for your comment, but that does not work. For diagonal edges in the image, a diagonal flow might be detected. Dropping the Y component will just give an X component that's too short.
Well, you can try limiting the ROI to a small vertical amount and just processing the image in horizontal stripes. Might work.
If it doesn't, you can probably alter the methods yourself to ignore any y displacement. That's harder.
ROI limiting does not work. The flow algorithms implemented in OpenCV require some margin along the image borders.
It should be possible to adjust the Gunnar Farneback Algorithm quite simply - the equation that finds the displacement from the calculated polynomials can be modified to solve along any given dimension. However I've found another approach, thus I don't need the modification anymore.