The main direction of this implementation is motion estimation and arrow marking .To get the motion direction , the system implements two ways . The first one , diamond search , is separating current frame and last frame into motion blocks , and doing the block-matching to estate the motion . The second one is affine model . Finding the main moving direction of whole frames .

DS (Diamond Search) Algorithm

    (1)Separate current frame and last frame into motion blocks, and use two diamond-like search patterns to do the block-matching for estimating the motion.

    (2) Search Pattern:Large Diamond Search Pattern(LDSP) & Small Diamond Search Pattern(SDSP)

Affine Motion Model

    An affine motion model is another way to estimate global motion in the system . It determines the parameters of translation .
    Affine transformations are computed from each pair of corresponding blocks to define pixel matching . The affine transform parameters for blocks can derived a single motion field . It can be used to identify differently moving objects between two adjacent frames .
    The affine transformation is utilized to reconstruct the image in a major motion of the input video . The system will store the difference between an affine image and the previous frame as another image . That black part in the image represents the object which is moving in the major motion or has no movement , other part of the image illustrates the object moving different ways from the major direction in the video . If the portion of the foreground is smaller than the background in frames , we can determine the black part in the differential image to be background , and others to be foreground .