Ask Your Question

Revision history [back]

  1. Both of frames for calcOpticalFlowPyrLK must be gray scale images (1 channel) with the same color depth and image size. It seams that your images differ in some of this parameters.

  2. You tries to draw red circles around features on gray scale one channel image. In this case circle function uses the first element of the cv::Scalar only. You get white circles instead red one. I think it is not the thing you want to do. You need to create seporate Mat with 3 channels, convert your gray scale image to RGB image and then draw circles. You got something like that:

    Mat drawMat; cvtColor(img1_gray_Mat, drawMat, CV_GRAY2RGB);

    for(std::vector<cv::keypoint>::iterator it=keyPoints1_vec.begin() it!=keyPoints1_vec.end(); it++) { points1_vec.push_back(it->pt); cv::circle(drawMat, it->pt,2,cv::Scalar(0,0,255)); }

    cv::imshow(win1_string, drawMat);