Ask Your Question
1

How to change the parameters of the Optical Flow Dual TV L1 implementation of OpenCV 2.4.4?

asked 2013-04-24 17:08:47 -0600

AReimann gravatar image

updated 2013-04-24 17:11:05 -0600

Hi, I somehow can't access / change the members of the TVL1 optical flow implementation (C++) after creating a pointer to it with cv::Ptr<cv::denseopticalflow> _flow = createOptFlow_DualTVL1(). I tried _flow->paramHelp("tau") and also _flow->info()->paramHelp("tau"). It gives me a "Bad argument (No parameter ´tau´ is foun)" error.

Acquiring the list of parameters with getParams gives me an empty vector.

Is this a bug or am I forgetting something?

Example code i tried for parameter printing (actually mostly just copy & paste from here):

cv::Ptr<cv::DenseOpticalFlow> _flow = createOptFlow_DualTVL1();
std::vector<std::string> parameters;
_flow->getParams(parameters);

for (int i = 0; i < (int) parameters.size(); i++) {
    std::string param = parameters[i];
    int type = _flow->paramType(param);
    std::string helpText = _flow->paramHelp(param);
    std::string typeText;

    switch (type) {
    case cv::Param::BOOLEAN:
        typeText = "bool";
        break;
    case cv::Param::INT:
        typeText = "int";
        break;
    case cv::Param::REAL:
        typeText = "real (double)";
        break;
    case cv::Param::STRING:
        typeText = "string";
        break;
    case cv::Param::MAT:
        typeText = "Mat";
        break;
    case cv::Param::ALGORITHM:
        typeText = "Algorithm";
        break;
    case cv::Param::MAT_VECTOR:
        typeText = "Mat vector";
        break;
    }
    std::cout << "Parameter '" << param << "' type=" << typeText << " help=" << helpText << std::endl;
}

parameters has the size 0 for me. I'm currently working with Visual Studio 2012.

edit retag flag offensive close merge delete

Comments

I am having the same problem. did you find any solution?

Dawit gravatar imageDawit ( 2013-10-14 21:30:50 -0600 )edit

1 answer

Sort by » oldest newest most voted
3

answered 2013-10-14 23:16:06 -0600

Dawit gravatar image

_flow->getDouble("tau"); // to get the value _flow->set("tau",0.125); // to change the value

Cheers

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-04-24 17:08:47 -0600

Seen: 1,553 times

Last updated: Oct 14 '13