Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

After some search, I think I can now answer my own questions.

What is the fast pyramids approach?

On browsing the OpenCV source code, in optflowgf.cpp, I found the following lines:

    // Crop unnecessary levels
    double scale = 1;
    int numLevelsCropped = 0;
    for (; numLevelsCropped < numLevels_; numLevelsCropped++)
    {
        scale *= pyrScale_;
        if (size.width*scale < min_size || size.height*scale < min_size)
            break;
    }

The above lines crop the pyramid levels which are smaller than min_size x min_size. Furthermore, min_size is defined, still in optflowgf.cpp, as

const int min_size = 32;

Finally, again in optflowgf.cpp, I found

    if (fastPyramids_)
    {
        // Build Gaussian pyramids using pyrDown()
        pyramid0_.resize(numLevelsCropped + 1);
        pyramid1_.resize(numLevelsCropped + 1);
        pyramid0_[0] = frames_[0];
        pyramid1_[0] = frames_[1];
        for (int i = 1; i <= numLevelsCropped; ++i)
        {
            pyrDown(pyramid0_[i - 1], pyramid0_[i]);
            pyrDown(pyramid1_[i - 1], pyramid1_[i]);
        }
    }

I would then say that fast pyramids skip too small pyramid levels.

In which way are we smoothing derivatives?

From Farneback's paper "Two-Frame Motion Estimation Based on Polynomial Expansion", my understanding is that the window function involved in eq. (12) is a Gaussian. From this point of view, polyN x polyN is the size of the window, while polySigma is the standard deviation of the Gaussian.