Hello,
I am trying to implement visual odometry via my webcam and the steps I have followed so far are the following:
1. Capture video from webcam (2 following frames each loop).
2. Undistort the frames with the callibration parameters I got.
3. Convert frames to gray scale.
4. Apply FAST algorithm for feature detection.
5. And now I am at the calcOpticalFlowPyrLK() step.
My issue is that at step 4 when I print the number of keypoints found in the 2 following frames I get different numbers between the frames (which is logical), but when I do the same thing after the calling of calcOpticalFlowPyrLK() I get the exact same number.
To be more specific, I have wrote:
vector kpointsframe1;
vector kpointsframe2;
vector pointsframe1;
vector pointsframe2;
vector status;
vector err;
Size winSize = Size(21,21);
TermCriteria termcrit = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS,30,0.01);
Mat Essential;
capture.read(frame1);
capture.read(frame2);
undistort(frame1,frame1undist,CameraMatrix,distCoeffs);
undistort(frame2,frame2undist,CameraMatrix,distCoeffs);
cvtColor(frame1undist,frame1gray,CV_BGR2GRAY);
cvtColor(frame2undist,frame2gray,CV_BGR2GRAY);
FAST(frame1gray,kpointsframe1,THRESHOLD_DIFFERENCE,false,FastFeatureDetector::TYPE_9_16);
FAST(frame2gray,kpointsframe2,THRESHOLD_DIFFERENCE,false,FastFeatureDetector::TYPE_9_16);
for(int i=0;i
↧