#include
"_cv.h"
#define
CONV( A, B, C)
( (
float
)( A +
(B<<1)
+ C ) )
typedef
struct
{
float
xx;
float
xy;
float
yy;
float
xt;
float
yt;
float
alpha;
/* alpha = 1 / ( 1/lambda + xx + yy ) */
}
icvDerProductEx;
/*F///////////////////////////////////////////////////////////////////////////////////////
//
Name: icvCalcOpticalFlowHS_8u32fR (Horn & Schunck method )
//
Purpose:
calculate
Optical
flow
for
2
images
using
Horn
&
Schunck
algorithm
//
Context:
//
Parameters:
//
imgA
-
pointer to first frame ROI
//
imgB
-
pointer to second frame ROI
//
imgStep
-
width
of
single
row
of
source
images
in
bytes
//
imgSize
-
size of the source image ROI
//
usePrevious
- use previous (input) velocity field.
//
velocityX
- pointer to horizontal and
//
velocityY
- vertical components of optical flow ROI
//
velStep
-
width
of
single
row
of
velocity
frames
in
bytes
//
lambda
- Lagrangian multiplier //
拉格朗日乘数
//
criteria
-
criteria
of
termination
processmaximum
number of iterations//
迭代终止条件
//
//
Returns: CV_OK
- all ok
//
CV_OUTOFMEM_ERR
- insufficient memory for function
work
//
CV_NULLPTR_ERR - if one of input pointers is NULL
//
CV_BADSIZE_ERR
- wrong input sizes interrelation
//
//
Notes:
1.Optical flow to be computed for every pixel in ROI
//
2.For calculating spatial derivatives we use 3x3 Sobel operator.