Ask Your Question

Revision history [back]

calcOpticalFlowSF() doesn't respond

Hi,

I try to use the calcOpticalFlowSF() function, but when I launch it, the programm doesn't repond, here the part of the code that use it:

 frame1 = cv::imread("frame10.png");
frame2 = cv::imread("frame11.png");

if (frame1.empty()) {
   cout<<"could not read image oldori"<<endl;

      return;
    }

    if (frame2.empty()) {
       cout<<"could not read image ori"<<endl;
      return;
    }

    if (frame1.rows != frame2.rows && frame1.cols != frame2.cols) {
         cout<<"images should be of equal sizes "endl;
      return;
    }

    if (frame1.type() != 16 || frame2.type() != 16) {
         cout<<"images should be of equal type CV_8UC3")endl;
      return;
    }

cv::Mat flow;

cv::calcOpticalFlowSF(frame1, frame2, flow, 2, 2, 4);
// calcOpticalFlowSF(frame1, frame1,  // doesn't work too.
//                    flow,
//                    3, 2, 4, 4.1, 25.5, 18, 55.0, 25.5, 0.35, 18, 55.0, 25.5, 10);

I know that the error come from the function calcOpticalFlowSF, because if I comment it, the programm works. I use the same pictures as they use in the SimpleFlow demo.

Do you have an idea why it doesn't work?

thanks,

best regards.