Implement Horn-Schunck optical flow with smoothness constraint to estimate the motion of pixels between two consecutive frames. This method is used to calculate the optical flow, which is the apparent motion of pixels in an image.
The Horn-Schunck method assumes that the brightness constancy of the scene is maintained between frames, which can be expressed as Ixu+Iyv+It=0, where Ix and Iy are the spatial gradients of the image intensity, It is the temporal gradient, and u and v are the horizontal and vertical components of the optical flow. To handle the aperture problem, a smoothness constraint is added to the energy function.
Here are the steps to calculate the optical flow:
This technique is widely used in video analysis and object tracking applications.
Two frames
Dense optical flow
Iteratively solve with smoothness regularization