The optical flow algorithm
is a method, mainly used in computer vision
, for matching two different images
are that the two images (let's say I1 and I2) are snapshots of the same scene, taken at different times.
Moreover, I1 and I2 must not be too different, in order for the algorithm to work.
The basic idea is to find, for every pixel
in I1, the corresponding pixel in I2 which minimize
the difference on the color intensities
Obviously some more constraints
are needed, in order to get a feasible
solution. Otherways, we could obtain a correspondance from many pixels in I1 to only one pixel in I2.
Then, the minimization of intensity distance is usually computed locally, i.e. on a small neighbourhood of the pixel p2 in I2, having the same coordinates of p1 in I1. In this way, given that neither the scene nor the illumination doesn't change too much, we will get a flow field
, saying which pixel in I2 corresponds to a given pixel in I1.
Other improvements to the algorithm have been developed, and the most effective is probably the coarse-to-fine strategy
that applies the optical flow to the images with different level of resolution
Note that the assumptions do not mean that the real
scene must be the same. Sure, you can compute the optical flow between two images of the same object while it's moving. On the other hand, you could also apply it to two different objects, as if they were the same object changing with the time. If the two objects are similar enough, it is possible to find the correspondences between their features.