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.

Implementing Lucas Kanade function

Hi everybody, 

I'm currently working on DSP DM6437 for visual tracking on vehicule. I aim to compute optical flow on real time in order to guess if a vehicule comes along in my direction. The input source is an analogical camera. 

I tried to implement the following pseudo-code and I have some issues : 

VLIB_xyGradientsAndMagnitude( InputImage->uBuffPtr, GRADX+1, GRADY+1, GRADMAG+1, w, h); 
VLIB_harrisScore_7x7(GRADX, GRADY, w, h, OUTM, wSensitivity, BUFFER); //sensitivity= 50
VLIB_nonMaxSuppress_5x5_S16(OUTM,w,h,wNonMaxSupress,out); //NonMaxSuppress = 18000

for (j=0; j<h; j++)
{
    for(i=0; i<w; i++)
    {
        if(out[i+j*w]==255)
        {
            wHarrisCol[inc]=i;
           wHarrisRow[inc]=j;
           corner_count ++;
        }
  }

}

First of all, my camera and my stage do not move, When I display Harris corner, some of them are a bit moving over the time.

Is there any way to stabilize those corners ? 

Since I want to compute optical flow on each new frame, I apply Lucas Kanade Tracking with previous image as input and next image as 2nd input as following

VLIB_trackFeaturesLucasKanade_7x7(InputImage).uBuffPtr,
(InputImageNext)).uBuffPtr,
GRADX, GRADY,
InputImage.wNbCol,
InputImage.wNbRow,
wCornerCount, POINTX, POINTY, NEWX, NEWY, 1, out);

I can obtain some estimated location a little bit shifted which should not. I don't understand why? Am I wrong to  refresh input feature coordinates with the estimated coordinates on each new frame  ? 

Regards.