Motion Detection

Detecting apparent motion of objects in a video scene is an important computer vision function and has several applications e.g. tracking, segmentation and compression. Optical flow based methods measure pattern of apparent motion of objects, surfaces, and edges in a visual scene caused by the relative motion between the camera and the scene. CUVI Lib provides two of the most commonly algorithms to compute optical flow between image pairs or a sequence of images. These include:

Horn & Schunck Optical Flow

This method computes the dense motion field between image pairs globally based on a brightness constancy assumption and a smoothness constraint on the computed flow field.

 2 Frames for Optical Flow       Output calculated by Optical Flow
 2 Consecutive Video Frames       Optical Flow Calculated using Horn & Schunck Algorithm

Lucas-Kanade Optical Flow

The Lucas–Kanade method is another widely used differential method for optical flow estimation developed by Bruce D. Lucas and Takeo Kanade. Unlike the Horn & Schunck method it assumes that the flow is essentially constant in a local neighbourhood of the image pixel under consideration, and solves the basic optical flow equations for all the pixels in that neighbourhood, by the least squares criterion. It is relatively more robust to image noise but fails in the interior of uniform intensity regions.

benchmark with OpenCV implementation
Benchmark of CUVI VS OpenCV Implementation of Optical Flow