0

I know this is a well documented problem but I didn't manage to find a satisfactory solution online. Here goes.

I am using cvCalcOpticalFlowPyrLK to track motion of feature points. I find the feature points with cvGoodFeaturesToTrack and refine it with cvFindCornerSubPix. I find the feature points in my first frame (reference frame) and use LK to track the movement of these points with respect to the reference frame. I update the points with current frame feature points coordinate with they are found. Heres what I observed:

1) The no. of good feature points found by cvGoodFeaturesToTrack is very little. I tried to find 100 points but I always get less than 10 points. 2) The no. of feature points after 5-6 frames decreased by 50 percent and then another 50 by 5 frames later, and this is when the subject is not in motion. The tracking is patchy in the sense some of the points are correctly tracked but some are way off.

I have seen demo application on youtube or iphone app. The drop off of the no. of feature points from frame to frame is not what I see in my application. So I am suspecting parameters I set might be wrong.

This is how I call the functions:

cvGoodFeaturesToTrack( image, eigen_image, temp_image, corners_point, &corner_count, 0.01(quality level), 3(min distance), 0, 10(block size), 0(use harris), 0.04(k));

cvFindCornerSubPix( image, cornersPoint, corner_count, cvSize(WINDOW_SIZE, WINDOW_SIZE), cvSize(-1, -1), cvTermCriteria(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 20, 0.3));

cvCalcOpticalFlowPyrLK(image, currentFrame, rpV->pyramid_images0, rpV->pyramid_images1, cornersPoint, cornersCurrent, corner_count, cvSize(WINDOW_SIZE, WINDOW_SIZE), 10(level), features_found, feature_errors, cvTermCriteria(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 20, 0.3), 0);

Another thing is that I am using a greyscale camera (infra red camera). I dont it matters by too much though. I am wondering if I am missing anything important here.

Any form of help is much appreciated.

Thanks, Kelvin

KelvinIPE
  • 29
  • 1
  • 8

1 Answers1

0

There are a few issues:

  • Calling cvFindCornerSubpix does not help if the features you are tracking don't look like corners of a checkerboard.
  • Use of a pyramid is appropriate only if the apparent motion is larger than the window size from frame to frame, for a reasonable window size.
  • Hard to tell why you are not getting enough good features to track without seeing your imagery. Perhaps it's rather blurry?
Francesco Callari
  • 11,300
  • 2
  • 25
  • 40
  • Thanks for pointing that out. I have seen plenty of face detection plus tracking example using cvFindCornerSubpix so I thought that can help. My images are not too blurry. However the illumination source is not uniform like ceiling light. Its infra red LED around the camera. Maybe this is the reason why it doesnt work because of LK intensity consistency assumption? – KelvinIPE Oct 10 '13 at 03:22
  • cvFindCornerSubpix, last time I looked, models the features as a saddle point of the intensity image. This is hardly ever the case in natural imagery - but it's ideal for checkerboards. Lighting variations might explain. Have you tried a simple normalized xcorr tracker? – Francesco Callari Oct 10 '13 at 13:08
  • I am not sure if xorr tracker can deal with rotation or scaling. If it can that would be perfect. I am trying to see if SURF is a better fit to my needs. – KelvinIPE Oct 11 '13 at 01:54
  • If you have rotation and moderate scaling, I'd start with an affine LK, avoiding the pyramid unless you absolutely have to. The nice thing about xcorr is that it is wicked fast over large windows, when implemented using FFT. – Francesco Callari Oct 11 '13 at 04:08
  • I have experience with xcorr. Since my subject of interest is a face, I can make the window size even smaller by doing face detection. But whatever I implement has to work with rotation and scaling. May I know what's the different between affine LK and the pyramidal one? – KelvinIPE Oct 11 '13 at 05:02
  • Hey thanks it seems like LK affine works better than LK optical. Another thing I observed is that by bypassing good feature to track(defining the feature point manually) it works much better. Any idea why this is happening? – KelvinIPE Oct 11 '13 at 08:30