MotEstRHT - a library for 2D motion analysis based on the RHT technique.
NAME
MotEstH2M,
MotEstH2MR,
MotEstH2Rs,
MotEstH2s,
MotEstH2_SegL2,
SegMot2
#include ''estimate4.h''
float MotEstH2s (FrCouple *FrData, MotionPara *BlData);
float MotEstH2Rs (FrCouple *FrData, MotionPara *BlData);
float MotEstH2M (FrCouple *FrData, MotionPara *BlData);
float MotEstH2MR (FrCouple *FrData, MotionPara *BlData);
int MotEstH2_SegL2 (FrCouple *FrData,MotionPara *BlData ,float Vx[2],float Vy[2],
struct Boundary *Border; struct GreyBoundary *Greylevel);
int SegMot2(FrCouple *FrData, MotionPara *BlData,float seg_th,int obj_ix);
The RHT- 2D motion estimation and segmentation library contains functions for
* estimation of 2D motion of a block in the image
* estimation and segmentation of multimodal (two objects moving with the
translational motion model) motions within a block
*
The FrCouple structure
The FrCouple structure holds the input data (frames) and it is defined as:
typedef struct FrCoupleStruct{
BARY *bpre,*bcon; /* original frames: bpre-previous (ref) */
/* bcon-consequtive */
FARY *fpre,*fcon; /* low-pass filtered frames: */
/* fpre-previous (ref) */
int filter_sigma; /* sigma of the low-pass filter used */
}FrCouple;
The MotionParaStruct
The MotionParaStruct holds the results of the motion analysis and it is defined as:
typedef
struct MotionParaStruct{
int coord_i,coord_j; /* block (region of interest) position */
/* defined by an upper left corner */
int size_i,size_j; /* block (ROI) size */
int image_i, image_j; /* image size */
int min_i, min_j, max_i, max_j; /* minimum and maximum values of indexes */
/* used when image size can be larger */
float a1,a2,a3,a4,a5,a6; /* estimated (computed) motion parameters*/
float c33,c36,c66,c11,c22; /* estimated confidence measures */
float acc12_sug, acc36_sug; /* quantization suggested by algorithm */
int acc12_req, acc36_req; /* quantisation required (imposed) by caller */
int quant_type; /* quant type: 0-no quant, */
/* 1-MSE based, 2-MAE */
int a1q,a2q,a3q,a4q,a5q,a6q; /* quantised motion parammeters */
int motion_model; /* motion model order */
int superblock_est; /* 0- no-est, 1- top-left, 2-top-right, */
/* 3-botom-left, 4-bot-rigt */
float MSE; /* Transformed frame diff. MSE */
float MSE_f; /* TFD of low-pass filtered frames, MSE */
float MSE_q; /* TFD with quantized parameters, MSE */
float MAE; /* Transformed frame diff. MAE */
float MAE_f; /* TFD of low-pass filtered frames, MAE */
float MAE_q; /* TFD with quantized parameters, MAE */
float inliers; /* number of inliers */
BARY *Mask_in; /* input segmentation Map */
BARY *Mask_out; /* output segmentation map */
int mask_off; /* mask_off: 1 - seg map off, 0 - seg map on */
DEB *internal; /* internal state of the RHE */
}MotionPara;
Before using any of the motion estimation functions, the data (inpu frames) has
to be loaded into the FrData structure and certain parameters have to be defined
in the MotionPara structure.
This can be acomplished by the following code:
/*--------------------- cut here -----------------------*/
int main(void)
{
return 0;
}
/*--------------------- cut here -----------------------*/
This function calculates translational motion of a rectangle block in the
image. Absolute value kernel (non-robust) is used. The position of the block
is specified by the following fields in the MotionPara structure:
int coord_i,coord_j - upper left corner of the block
int size_i,size_j - size of the block
int quant_type - quantisation (yes/no, parameters)
In addition, if quantisation of the motion parameters is required,
the field quant_type should be set to a non-zero value, depending
on the required quantisation criterion.
Quantisation type - quant_type
parameter value
This function returns the following parameters:
BlData->a3 - vx velocity component
BlData->a6 - vy velocity component
BlData->motion_model - this is set to 2 (two D model = translational model)
BlData->MAE_f - mean absolute prediction error for (a3,a6) motion parameters
calculated from the low-pass filtered (float valued) frames
BlData->MSE - mean square prediction error for (a3,a6) motion parameters
calculated from the original (integer valued) frames
BlData->MSE_f - mean square prediction error for (a3,a6) motion parameters
calculated from the low-pass filtered (float valued) frames
In addition, if quantisation was specified, the following values will be set:
BlData->a3q - quantised vx velocity component
BlData->a6q - quantised vy velocity component
BlData->MSE_q - mean square prediction error for quantised motion parameters
(a3q, a6q) calculated from the original (integer valued) frames
BlData->MSA_a - mean absolute prediction error for quantised motion parameters
(a3q, a6q) calculated from the low-pass filtered (float
valued) frames
This function calculates translational motion of a rectangle block in the
image using a robust statistical kernel. Input parameters required are the
same as for the MotEstH2s. In addition, this function sets the following
fields:
BlData->inliers - a proportion of the inliers, float from [0,1]
BlData->scale - scale of the residual errors
This function is exactly the same as MotEstH2s, with the exception that
motion is estimated only for a part of the block. The coordinates of the
block have the function of Rectangle of Interest (ReOI). Which pixels from
the ReOI should be used during the estimation is specified by an input
segmentation map (BlData->Mask_in) and the region of interest number
(BlData->roi_number).
If, for example, BlData->roi_number is set to 5, then the estimation is
only performed for the pixels that have value 5 in the BlData->roi_number.
This function is a combination of MotEstH2M with robust kernels.
Miroslaw Bober, Vision Speech and Signal Processing Group,
University of Surrey, Guildford, Surrey, GU2 5XH, United Kingdom.
M.Bober@ee.surrey.ac.uk
03-Feb-98. Automatically converted by man2html,
written by G.Matas (g.matas@ee.surrey.ac.uk)