This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Lucas Kanade optic flow of issue

Hello  every once:
I trying to use "VLIB_trackFeaturesLucasKanade_7x7"and dispay window tracking a target,but it didn't dispay window tracking .

my code as following:


while(1)
{



GetImage(RGBimage);


if(input_feild!=NULL)
{
//VLIB_imagePyramid8(input_feild,piramidSizeX, piramidSizeY,calculatedOutData_Pyramid8);
GreyTran(RGBimage, GREYimage);
//Initially point to the end of pyramids
piramidSizeX=100;
piramidSizeY=60;

pCalculatedOutData_Pyramid = calculatedOutData_Pyramid8+(400*240+200*120+100*60);
pCalculatedOutData_Pyramid_previous= pCalculatedOutData_Pyramid_previous+(400*240+200*120+100*60);
//We will start form the smallest image (deepest level) in pyramid ,and go towards original resolution
GetImage(pCalculatedOutData_Pyramid);
// GetImage(pCalculatedOutData_Pyramid_previous);

//x,y will have feature co-ordinates of input_field_previous.mX,mY are to have feature co-ordinates of input_feild.
//Since we are starting with deepest level in pyramid , the initial estimates of mX, mY are same as the features of level 3
//image of input_feild previous These will be updated on first call to VLIB_trackFeatureLucaskanade_7*7
for (i=0;i<nTrackedPoints;i++){
mX[i]=X[i]>>3;
mY[i]=Y[i]>>3;

}
//Three iterations starting from level 3 of pyramid up to level 1
for (i=01;i<3;i--){
for (j=0;j<nTrackedPoints;j++){
X_pyramid[j]=X[j]>>i;
Y_pyramid[j]=Y[j]>>i;

}
//Move pointers to beginning of level i image of the pyramid
pCalculatedOutData_Pyramid =pCalculatedOutData_Pyramid -(piramidSizeX*piramidSizeY);
pCalculatedOutData_Pyramid_previous=pCalculatedOutData_Pyramid_previous-(piramidSizeX*piramidSizeY);
//GreyImageDraw(&g_sContext, GREYimage, 0, 0);
GetImage(pCalculatedOutData_Pyramid);
GetImage(pCalculatedOutData_Pyramid_previous);
//Estimates mX,mY are updated at level i image of the pyramid .Input features are X_pyramid,Y_pyramid
VLIB_xyGradientsAndMagnitude(pCalculatedOutData_Pyramid,GRADX+piramidSizeX+1,GRADY+piramidSizeY+1,GRADMAG+piramidSizeX+1,
piramidSizeX,piramidSizeY-1);
VLIB_trackFeaturesLucasKanade_7x7(pCalculatedOutData_Pyramid_previous,pCalculatedOutData_Pyramid,GRADX,GRADY,piramidSizeX,
piramidSizeY,nTrackedPoints,X_pyramid, Y_pyramid,mX,mY,10,BUFFER);
GetImage(pCalculatedOutData_Pyramid_previous);
//updated pyramid image size for next iteration
piramidSizeX=piramidSizeX<<1;
piramidSizeY=piramidSizeY<<1;
//GreyImageDraw(&g_sContext, GREYimage, 0, 0);
//mX,mY refined at this level i are scaled to become estimates for next iteration
for ( j=0;j<nTrackedPoints;j++){
mX[j]=mX[j]<<i;
mY[j]=mY[j]<<i;


}

}
//Refine mX,mY Fourth time for original resolution for fine tuning
VLIB_xyGradientsAndMagnitude(input_field_previous,GRADX+piramidSizeX+1,GRADY+piramidSizeY+1,GRADMAG+piramidSizeX+1,
piramidSizeX,piramidSizeY-1);
VLIB_trackFeaturesLucasKanade_7x7(input_field_previous,input_feild,GRADX,GRADY,piramidSizeX,
piramidSizeY,nTrackedPoints,X, Y,mX,mY,10,BUFFER);
//mX,mY will now have features input_field
GetImage(pCalculatedOutData_Pyramid_previous);
//current frame and its feature become previous
pCalculatedOutData_Pyramid_previous=pCalculatedOutData_Pyramid;
input_field_previous[800*480] = input_feild[800*480];
for (i=0;i<nTrackedPoints;i++){
X[i]=mX[i];
Y[i]=mY[i];


}
GetImage(input_field_previous);

//void VLIB_normalFlow_16(
//input_feild-input_field_previous,

}
else{
UARTPuts("Image No input_field---Break......\r\n", -1);

break;
}
return 0;
}
}

Thanks and Regards!