int main()

in calc_homography/myflow.cpp [166:211]


int main(int argc, const char* argv[])
{
    if (argc < 3)
    {
        cerr << "Usage : " << argv[0] << "<frame0> <frame1>" << endl;
        return -1;
    }

    Mat frame0 = imread(argv[1], IMREAD_GRAYSCALE);
    Mat frame1 = imread(argv[2], IMREAD_GRAYSCALE);

    if (frame0.empty())
    {
        cerr << "Can't open image ["  << argv[1] << "]******" << endl;
        return -1;
    }
    if (frame1.empty())
    {
        cerr << "Can't open image ["  << argv[2] << "]" << endl;
        return -1;
    }

    if (frame1.size() != frame0.size())
    {
        cerr << "Images should be of equal sizes" << endl;
        return -1;
    }

    GpuMat d_frame0(frame0);
    GpuMat d_frame1(frame1);

    GpuMat d_flowx(frame0.size(), CV_32FC1);
    GpuMat d_flowy(frame0.size(), CV_32FC1);

    //OpticalFlowDual_TVL1_GPU tvl1;
    BroxOpticalFlow brox(0.197f, 50.0f, 0.8f, 10, 77, 10);
    GpuMat d_frame0f;
    GpuMat d_frame1f;
    d_frame0.convertTo(d_frame0f, CV_32F, 1.0 / 255.0);
    d_frame1.convertTo(d_frame1f, CV_32F, 1.0 / 255.0);
    brox(d_frame0f, d_frame1f, d_flowx, d_flowy);

    saveFlow(d_flowx, d_flowy, "dx.txt", "dy.txt");

    return 0;
}