Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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").

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.

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

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")._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.