std::vector<cv::Point2f> prevPoints, currPoints;
std::vector<float> error; // stores the SSD error.
std::vector<uchar> status;// stores a flag of successful tracking / I recomend to ignore it.
cv::Mat prevGrayImg,currGrayImg;
// <- insert code for read the images
// initalize grid or the features you want to track
for( int r = 0; r < prevGrayImg.rows;r+=5){
for( int c = 0; c < prevGrayImg.cols;c+=5){
prevPoints.push_back(cv::Point2f(c,r));
}}
// apply pyramidal lucas kanade
cv::calcOpticalFlowPyrLK(prevGrayImg, currGrayImg, prevPoints, currPoints, status, error);
for( unsigned int i = 0; i < prevPoints.size(); i++){
float x0 = prevPoints[i].x;
float y0 = prevPoints[i].y;
float x1 = currPoints[i].x;
float y1 = currPoints[i].y;
}