Hi all,
I want to use VLIB's functions (Lucas-Kanade Feature Tracking) for hand tracking system. My code like this:
- First, I use Harris Score:
VLIB_xyGradientsAndMagnitude(image1, GRADX+IMAGEWIDTH+1, GRADY+IMAGEWIDTH+1, GRADMAG+IMAGEWIDTH+1, IMAGEWIDTH, IMAGEHEIGHT);
VLIB_harrisScore_7x7(GRADX, GRADY, IMAGEWIDTH, IMAGEHEIGHT, OUTM, 1310, BUFFER);
VLIB_nonMaxSuppress_7x7_S16(OUTM, IMAGEWIDTH, IMAGEHEIGHT, 1000, OUT);
for(i = 0; i < IMAGEHEIGHT; i++)
{
for(j = 0; j < IMAGEWIDTH; j++)
{
if(*(OUT + i*IMAGEWIDTH + j) == 255)
{
X[nFeatures] = j << 4;
Y[nFeatures] = i << 4;
mX[nFeatures] = feaX[nFeatures];
mY[nFeatures] = feaY[nFeatures];
nFeatures++;
}
}
}
- Then, I use Lucas-Kanade:
VLIB_trackFeaturesLucasKanade_7x7(imag1, image2, GRADX, GRADY, IMAGEWIDTH, IMAGEHEIGHT, nFeatures, X, Y, mX, mY, 10, BUFFER);
With IMAGEWIDTH = 640; IMAGEHEIGHT = 480;
Now the problem is when I process the image2 some of the value in mX[] and mY[] array become negative after calling VLIB_trackFeaturesLucasKanade_7x7 function.
My question is why these values should become negative ? How to overcome this problem ?
Thanks & Regards,
Phong