'Calculate affine motion model coefficients using OpenCV in C++

In order to correctly represent the camera motion characterization, I have to find different camera operations (such as Zoom, Pan, Rot and Tilt) in a video. These camera operations can be determined by setting a threshold based on the coefficients of afine motion model.
Reference: Efficient camera motion characterization for MPEG video indexing!

Below is motion vector (u,v) , a 2 x 1 matrix is expressed as the position of Macroblock (x, y), a 2x1 matrix. (a1, a4) is another 2x1 matrix and (a2, a3, a, a6) is a 2x2 matrix.

row1    u             a2    a3         x            a1
                  = [          ] *  [     ]    + [      ]
row2    v             a5    a6         y            a4


Phi = (a1, a2, a3, a4 , a5, a6)  are the coefficients (parameters) generated after applying Afine Motion Model fitting over MVF (Motion Vector Fields).

Further Camera Operations can easily be defined in terms of these parameters.
Such as,    pan = a1,
            tilt= a4,
            div (zoom)  = 0.5 * (a2 + a6)
     and    rot = 0.5 * (a5 - a3)

So my questions is which OpenCV API/functions can be used to determine these parameters. Thanks



Solution 1:[1]

I have found the answer to this questions. We can found these parameters using the algorithms given in paper.

"J. Konrad and F. Dufaux. Improved global motion estimation for N3. ISO/IEC JTC1/SC29/WG11 M3096, 1998."

Thanks

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vishal