0%

Introduction of Optical Flow Algorithm

  1. Introduction
  2. Assumptions
  3. Formula Deducing
  4. Attention
  5. Reference and Further reading

Introduction

Optical Flow is a motion of a certain target in consecutive frames, which is caused by the motion of target, scene or camera. It reflects the image changes caused by motion in a small time interval to determine the direction and speed of motion of the image points.

Assumptions

Optical Flow provide the clue of motion recovering. It mainly depends on three assumptions:

  1. [Constant light] The pixel light of target is constant in consecutive frames;
  2. [Time sequence] The time interval of consecutive frames is so small that the change of time can be ignore when considering the motion change(This assumption is to be used for deducing the core formula of Optical Flow Algorithm);
  3. [Neighborhood consistency] Neighbor pixels have the similar motion.

Formula Deducing

Assumed that the light of a certain pixel is in moment . After , this pixel has the same light with that in after a motion , means that.

Performing a first order taylor expansion on the right side of the equation, we can obtain a formula below.

means that.

therefore.

It’s matrix format is like this;

where are partial derivative of light of in direction and , namely gradient. is the partial derivative of light of in moment . is the light difference of between consecutive frames. So , the equation can be written as that.

In consecutive frames, are known, are optical flow unknown.

According to assumption 3, the neighbor pixels have the same optical flow, we can choose a neighbor region centered on .

image-20200716151923939

Considering all pixels in neighbor region, we can obtain a matrix formula.

The equation can be written as . Therefore, the solution of optical flow in can be compute by least square:

Attention

The is required to be invertible. If not, it may cause a aperture problem. As the GIF shown left, the motion of stripe can not be detect through the circle aperture. So, Lucas and Kanade proposed selecting those “invertible” pixels for computing optical flow. This kind of pixels are usually some corner points, which are detected by Harris or other Algorithm.

image-20200716152109337

Except mentioned above, Lucas and Kanade proposed using pyramid images to solve the problem caused by large offset. Eventually, Lucas-Kanade’s method was used to obtain sparse optical flow. The Lucas-Kanade method is a classical optical flow algorithm. Farneback proposed a method to obtain dense optical flow in 2003. The GIF below is the compare of sparse and dense optical flow.

image-20200716152223411

In ICCV2015, a group proposed a deep learning method FlowNet to solve problems of optical flow estimation using CNN. In CVPR2017, the same group proposed a modified FlowNet2.0. FlowNet2.0 is the most popular paper in optical flow field since 2015.

Reference and Further reading

Farneback: https://blog.csdn.net/xholes/article/details/79894340

Flow Net: https://zhuanlan.zhihu.com/p/37736910

Flow Net: https://zhuanlan.zhihu.com/p/74460341