One of the most intriguing things about Optical Flow is the calculation of Focus of Expansion or FoE. FoE is the point where all flow vectors converge when a camera moves in a forward direction. It often indicates the direction where a camera is heading or aimed at, and is also regarded as the same point where flow vectors diverge from when the camera moves backwards. FoE plays a key role in most computer vision applications, including self-driving cars, guided missiles, obstacle detection and in robotics. To succeed in its applications, FoE should be calculated in real-time consistently at a fairly accurate level. The following is a demonstration of my algorithm for this, where I estimate the FoE using a probabilistic approach. This calculates the FoE for a single camera that has an inconsistent motion model.
The red circle signifies the FoE in question below.
Here I first obtain a set of sparse flow vectors as described in here. The flow vectors are obtained at frame rate using the Lucas Kannade method and when the number of flow vectors fall below a minimum threshold, flow vectors are re-calculated. Then the algorithm seeks the linear functions for those flow vectors (normalized) and then finds the intersection points for those linear functions. In the ideal case, these intersection points must coincide with each other as it theoretically represents the FoE, but due to the error, they don’t. Therefore we need to filter out the error. To do this, intersection points are arranged into a histogram and then the maximum bin will be taken out. Intersection points that fit inside the maximum bin are further filtered out through a Discrete Kalman Filter in order to estimate (or predict) the most likely intersection point (i.e. FoE).