I use this to functions as a base of my tracking algorithm.
//1. detect the features
cv::goodFeaturesToTrack(gray_prev, // the image
features,
cv::calcOpticalFlowPyrLK(..) function uses arguments :
cv::calcOpticalFlowPyrLK(prev_gray, curr_gray, features_prev, features_next, status, err);
cv::Mat prev_gray, curr_gray;
std::vector features_prev, features_next;
std::vector status;
std::vector err;
simplest(partial) code to find pixel in next frame :
features_prev.push_back(cv::Point(4, 5));
cv::calcOpticalFlowPyrLK(prev_gray, curr_gray, features_prev, features_next, status, err);
If pixel was successfully found status[0] == 1 and features_next[0] will show coordinates of pixel in next frame. Value information can be found in this example: OpenCV/samples/cpp/lkdemo.cpp