algorithm.cpp 22 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721
/*M///////////////////////////////////////////////////////////////////////////////////////
//
//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
//  By downloading, copying, installing or using the software you agree to this license.
//  If you do not agree to this license, do not download, install,
//  copy or use the software.
//
//
//                           License Agreement
//                For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//   * Redistribution's of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//
//   * Redistribution's in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//
//   * The name of the copyright holders may not be used to endorse or promote products
//     derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

#include "precomp.hpp"

namespace cv
{

using std::pair;

template<typename _KeyTp, typename _ValueTp> struct sorted_vector
{
    sorted_vector() {}
    void clear() { vec.clear(); }
    size_t size() const { return vec.size(); }
    _ValueTp& operator [](size_t idx) { return vec[idx]; }
    const _ValueTp& operator [](size_t idx) const { return vec[idx]; }

    void add(const _KeyTp& k, const _ValueTp& val)
    {
        pair<_KeyTp, _ValueTp> p(k, val);
        vec.push_back(p);
        size_t i = vec.size()-1;
        for( ; i > 0 && vec[i].first < vec[i-1].first; i-- )
            std::swap(vec[i-1], vec[i]);
        CV_Assert( i == 0 || vec[i].first != vec[i-1].first );
    }

    bool find(const _KeyTp& key, _ValueTp& value) const
    {
        size_t a = 0, b = vec.size();
        while( b > a )
        {
            size_t c = (a + b)/2;
            if( vec[c].first < key )
                a = c+1;
            else
                b = c;
        }

        if( a < vec.size() && vec[a].first == key )
        {
            value = vec[a].second;
            return true;
        }
        return false;
    }

    void get_keys(vector<_KeyTp>& keys) const
    {
        size_t i = 0, n = vec.size();
        keys.resize(n);

        for( i = 0; i < n; i++ )
            keys[i] = vec[i].first;
    }

    vector<pair<_KeyTp, _ValueTp> > vec;
};


template<typename _ValueTp> inline const _ValueTp* findstr(const sorted_vector<string, _ValueTp>& vec,
                                                           const char* key)
{
    if( !key )
        return 0;

    size_t a = 0, b = vec.vec.size();
    while( b > a )
    {
        size_t c = (a + b)/2;
        if( strcmp(vec.vec[c].first.c_str(), key) < 0 )
            a = c+1;
        else
            b = c;
    }

    if( strcmp(vec.vec[a].first.c_str(), key) == 0 )
        return &vec.vec[a].second;
    return 0;
}


Param::Param()
{
    type = 0;
    offset = 0;
    readonly = false;
    getter = 0;
    setter = 0;
}


Param::Param(int _type, bool _readonly, int _offset,
             Algorithm::Getter _getter, Algorithm::Setter _setter,
             const string& _help)
{
    type = _type;
    readonly = _readonly;
    offset = _offset;
    getter = _getter;
    setter = _setter;
    help = _help;
}

struct CV_EXPORTS AlgorithmInfoData
{
    sorted_vector<string, Param> params;
    string _name;
};


static sorted_vector<string, Algorithm::Constructor>& alglist()
{
    static sorted_vector<string, Algorithm::Constructor> alglist_var;
    return alglist_var;
}

void Algorithm::getList(vector<string>& algorithms)
{
    alglist().get_keys(algorithms);
}

Ptr<Algorithm> Algorithm::_create(const string& name)
{
    Algorithm::Constructor c = 0;
    if( !alglist().find(name, c) )
        return Ptr<Algorithm>();
    return c();
}

Algorithm::Algorithm()
{
}

Algorithm::~Algorithm()
{
}

string Algorithm::name() const
{
    return info()->name();
}

void Algorithm::set(const string& parameter, int value)
{
    info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
}

void Algorithm::set(const string& parameter, double value)
{
    info()->set(this, parameter.c_str(), ParamType<double>::type, &value);
}

void Algorithm::set(const string& parameter, bool value)
{
    info()->set(this, parameter.c_str(), ParamType<bool>::type, &value);
}

void Algorithm::set(const string& parameter, const string& value)
{
    info()->set(this, parameter.c_str(), ParamType<string>::type, &value);
}

void Algorithm::set(const string& parameter, const Mat& value)
{
    info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value);
}

void Algorithm::set(const string& parameter, const vector<Mat>& value)
{
    info()->set(this, parameter.c_str(), ParamType<vector<Mat> >::type, &value);
}

void Algorithm::set(const string& parameter, const Ptr<Algorithm>& value)
{
    info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value);
}

void Algorithm::set(const char* parameter, int value)
{
    info()->set(this, parameter, ParamType<int>::type, &value);
}

void Algorithm::set(const char* parameter, double value)
{
    info()->set(this, parameter, ParamType<double>::type, &value);
}

void Algorithm::set(const char* parameter, bool value)
{
    info()->set(this, parameter, ParamType<bool>::type, &value);
}

void Algorithm::set(const char* parameter, const string& value)
{
    info()->set(this, parameter, ParamType<string>::type, &value);
}

void Algorithm::set(const char* parameter, const Mat& value)
{
    info()->set(this, parameter, ParamType<Mat>::type, &value);
}

void Algorithm::set(const char* parameter, const vector<Mat>& value)
{
    info()->set(this, parameter, ParamType<vector<Mat> >::type, &value);
}

void Algorithm::set(const char* parameter, const Ptr<Algorithm>& value)
{
    info()->set(this, parameter, ParamType<Algorithm>::type, &value);
}

int Algorithm::getInt(const string& parameter) const
{
    return get<int>(parameter);
}

double Algorithm::getDouble(const string& parameter) const
{
    return get<double>(parameter);
}

bool Algorithm::getBool(const string& parameter) const
{
    return get<bool>(parameter);
}

string Algorithm::getString(const string& parameter) const
{
    return get<string>(parameter);
}

Mat Algorithm::getMat(const string& parameter) const
{
    return get<Mat>(parameter);
}

vector<Mat> Algorithm::getMatVector(const string& parameter) const
{
    return get<vector<Mat> >(parameter);
}

Ptr<Algorithm> Algorithm::getAlgorithm(const string& parameter) const
{
    return get<Algorithm>(parameter);
}

string Algorithm::paramHelp(const string& parameter) const
{
    return info()->paramHelp(parameter.c_str());
}

int Algorithm::paramType(const string& parameter) const
{
    return info()->paramType(parameter.c_str());
}

int Algorithm::paramType(const char* parameter) const
{
    return info()->paramType(parameter);
}

void Algorithm::getParams(vector<string>& names) const
{
    info()->getParams(names);
}

void Algorithm::write(FileStorage& fs) const
{
    info()->write(this, fs);
}

void Algorithm::read(const FileNode& fn)
{
    info()->read(this, fn);
}


AlgorithmInfo::AlgorithmInfo(const string& _name, Algorithm::Constructor create)
{
    data = new AlgorithmInfoData;
    data->_name = _name;
    if (!alglist().find(_name, create))
        alglist().add(_name, create);
}

AlgorithmInfo::~AlgorithmInfo()
{
    delete data;
}

void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
{
    size_t i = 0, nparams = data->params.vec.size();
    cv::write(fs, "name", algo->name());
    for( i = 0; i < nparams; i++ )
    {
        const Param& p = data->params.vec[i].second;
        const string& pname = data->params.vec[i].first;
        if( p.type == Param::INT )
            cv::write(fs, pname, algo->get<int>(pname));
        else if( p.type == Param::BOOLEAN )
            cv::write(fs, pname, (int)algo->get<bool>(pname));
        else if( p.type == Param::REAL )
            cv::write(fs, pname, algo->get<double>(pname));
        else if( p.type == Param::STRING )
            cv::write(fs, pname, algo->get<string>(pname));
        else if( p.type == Param::MAT )
            cv::write(fs, pname, algo->get<Mat>(pname));
        else if( p.type == Param::MAT_VECTOR )
            cv::write(fs, pname, algo->get<vector<Mat> >(pname));
        else if( p.type == Param::ALGORITHM )
        {
            WriteStructContext ws(fs, pname, CV_NODE_MAP);
            Ptr<Algorithm> nestedAlgo = algo->get<Algorithm>(pname);
            nestedAlgo->write(fs);
        }
        else
            CV_Error( CV_StsUnsupportedFormat, "unknown/unsupported parameter type");
    }
}

void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
{
    size_t i = 0, nparams = data->params.vec.size();
    AlgorithmInfo* info = algo->info();

    for( i = 0; i < nparams; i++ )
    {
        const Param& p = data->params.vec[i].second;
        const string& pname = data->params.vec[i].first;
        const FileNode n = fn[pname];
        if( n.empty() )
            continue;
        if( p.type == Param::INT )
        {
            int val = (int)n;
            info->set(algo, pname.c_str(), p.type, &val, true);
        }
        else if( p.type == Param::BOOLEAN )
        {
            bool val = (int)n != 0;
            info->set(algo, pname.c_str(), p.type, &val, true);
        }
        else if( p.type == Param::REAL )
        {
            double val = (double)n;
            info->set(algo, pname.c_str(), p.type, &val, true);
        }
        else if( p.type == Param::STRING )
        {
            string val = (string)n;
            info->set(algo, pname.c_str(), p.type, &val, true);
        }
        else if( p.type == Param::MAT )
        {
            Mat m;
            cv::read(n, m);
            info->set(algo, pname.c_str(), p.type, &m, true);
        }
        else if( p.type == Param::MAT_VECTOR )
        {
            vector<Mat> mv;
            cv::read(n, mv);
            info->set(algo, pname.c_str(), p.type, &mv, true);
        }
        else if( p.type == Param::ALGORITHM )
        {
            Ptr<Algorithm> nestedAlgo = Algorithm::_create((string)n["name"]);
            CV_Assert( !nestedAlgo.empty() );
            nestedAlgo->read(n);
            info->set(algo, pname.c_str(), p.type, &nestedAlgo, true);
        }
        else
            CV_Error( CV_StsUnsupportedFormat, "unknown/unsupported parameter type");
    }
}

string AlgorithmInfo::name() const
{
    return data->_name;
}

union GetSetParam
{
    int (Algorithm::*get_int)() const;
    bool (Algorithm::*get_bool)() const;
    double (Algorithm::*get_double)() const;
    string (Algorithm::*get_string)() const;
    Mat (Algorithm::*get_mat)() const;
    vector<Mat> (Algorithm::*get_mat_vector)() const;
    Ptr<Algorithm> (Algorithm::*get_algo)() const;

    void (Algorithm::*set_int)(int);
    void (Algorithm::*set_bool)(bool);
    void (Algorithm::*set_double)(double);
    void (Algorithm::*set_string)(const string&);
    void (Algorithm::*set_mat)(const Mat&);
    void (Algorithm::*set_mat_vector)(const vector<Mat>&);
    void (Algorithm::*set_algo)(const Ptr<Algorithm>&);
};

void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, const void* value, bool force) const
{
    const Param* p = findstr(data->params, parameter);

    if( !p )
        CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", parameter ? parameter : "<NULL>") );

    if( !force && p->readonly )
        CV_Error_( CV_StsError, ("Parameter '%s' is readonly", parameter));

    GetSetParam f;
    f.set_int = p->setter;

    if( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL )
    {
        CV_Assert( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN );

        if( p->type == Param::INT )
        {
            int val = argType == Param::INT ? *(const int*)value :
                argType == Param::BOOLEAN ? (int)*(const bool*)value :
                saturate_cast<int>(*(const double*)value);
            if( p->setter )
                (algo->*f.set_int)(val);
            else
                *(int*)((uchar*)algo + p->offset) = val;
        }
        else if( p->type == Param::BOOLEAN )
        {
            bool val = argType == Param::INT ? *(const int*)value != 0 :
                    argType == Param::BOOLEAN ? *(const bool*)value :
                    *(const double*)value != 0;
            if( p->setter )
                (algo->*f.set_bool)(val);
            else
                *(bool*)((uchar*)algo + p->offset) = val;
        }
        else
        {
            double val = argType == Param::INT ? (double)*(const int*)value :
                         argType == Param::BOOLEAN ? (double)*(const bool*)value :
                        *(const double*)value;
            if( p->setter )
                (algo->*f.set_double)(val);
            else
                *(double*)((uchar*)algo + p->offset) = val;
        }
    }
    else if( argType == Param::STRING )
    {
        CV_Assert( p->type == Param::STRING );

        const string& val = *(const string*)value;
        if( p->setter )
            (algo->*f.set_string)(val);
        else
            *(string*)((uchar*)algo + p->offset) = val;
    }
    else if( argType == Param::MAT )
    {
        CV_Assert( p->type == Param::MAT );

        const Mat& val = *(const Mat*)value;
        if( p->setter )
            (algo->*f.set_mat)(val);
        else
            *(Mat*)((uchar*)algo + p->offset) = val;
    }
    else if( argType == Param::MAT_VECTOR )
    {
        CV_Assert( p->type == Param::MAT_VECTOR );

        const vector<Mat>& val = *(const vector<Mat>*)value;
        if( p->setter )
            (algo->*f.set_mat_vector)(val);
        else
            *(vector<Mat>*)((uchar*)algo + p->offset) = val;
    }
    else if( argType == Param::ALGORITHM )
    {
        CV_Assert( p->type == Param::ALGORITHM );

        const Ptr<Algorithm>& val = *(const Ptr<Algorithm>*)value;
        if( p->setter )
            (algo->*f.set_algo)(val);
        else
            *(Ptr<Algorithm>*)((uchar*)algo + p->offset) = val;
    }
    else
        CV_Error(CV_StsBadArg, "Unknown/unsupported parameter type");
}

void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argType, void* value) const
{
    const Param* p = findstr(data->params, parameter);
    if( !p )
        CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", parameter ? parameter : "<NULL>") );

    GetSetParam f;
    f.get_int = p->getter;

    if( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL )
    {
        if( p->type == Param::INT )
        {
            CV_Assert( argType == Param::INT || argType == Param::REAL );
            int val = p->getter ? (algo->*f.get_int)() : *(int*)((uchar*)algo + p->offset);

            if( argType == Param::INT )
                *(int*)value = val;
            else
                *(double*)value = val;
        }
        else if( p->type == Param::BOOLEAN )
        {
            CV_Assert( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL );
            bool val = p->getter ? (algo->*f.get_bool)() : *(bool*)((uchar*)algo + p->offset);

            if( argType == Param::INT )
                *(int*)value = (int)val;
            else if( argType == Param::BOOLEAN )
                *(bool*)value = val;
            else
                *(double*)value = (int)val;
        }
        else
        {
            CV_Assert( argType == Param::REAL );
            double val = p->getter ? (algo->*f.get_double)() : *(double*)((uchar*)algo + p->offset);

            *(double*)value = val;
        }
    }
    else if( argType == Param::STRING )
    {
        CV_Assert( p->type == Param::STRING );

        *(string*)value = p->getter ? (algo->*f.get_string)() :
            *(string*)((uchar*)algo + p->offset);
    }
    else if( argType == Param::MAT )
    {
        CV_Assert( p->type == Param::MAT );

        *(Mat*)value = p->getter ? (algo->*f.get_mat)() :
            *(Mat*)((uchar*)algo + p->offset);
    }
    else if( argType == Param::MAT_VECTOR )
    {
        CV_Assert( p->type == Param::MAT_VECTOR );

        *(vector<Mat>*)value = p->getter ? (algo->*f.get_mat_vector)() :
        *(vector<Mat>*)((uchar*)algo + p->offset);
    }
    else if( argType == Param::ALGORITHM )
    {
        CV_Assert( p->type == Param::ALGORITHM );

        *(Ptr<Algorithm>*)value = p->getter ? (algo->*f.get_algo)() :
            *(Ptr<Algorithm>*)((uchar*)algo + p->offset);
    }
    else
        CV_Error(CV_StsBadArg, "Unknown/unsupported parameter type");
}


int AlgorithmInfo::paramType(const char* parameter) const
{
    const Param* p = findstr(data->params, parameter);
    if( !p )
        CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", parameter ? parameter : "<NULL>") );
    return p->type;
}


string AlgorithmInfo::paramHelp(const char* parameter) const
{
    const Param* p = findstr(data->params, parameter);
    if( !p )
        CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", parameter ? parameter : "<NULL>") );
    return p->help;
}


void AlgorithmInfo::getParams(vector<string>& names) const
{
    data->params.get_keys(names);
}


void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argType,
                              void* value, bool readOnly,
                              Algorithm::Getter getter, Algorithm::Setter setter,
                              const string& help)
{
    CV_Assert( argType == Param::INT || argType == Param::BOOLEAN ||
               argType == Param::REAL || argType == Param::STRING ||
               argType == Param::MAT || argType == Param::MAT_VECTOR ||
               argType == Param::ALGORITHM );
    data->params.add(string(parameter), Param(argType, readOnly,
                     (int)((size_t)value - (size_t)(void*)&algo),
                     getter, setter, help));
}


void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
                             int& value, bool readOnly,
                             int (Algorithm::*getter)(),
                             void (Algorithm::*setter)(int),
                             const string& help)
{
    addParam_(algo, parameter, ParamType<int>::type, &value, readOnly,
              (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}

void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
                             bool& value, bool readOnly,
                             int (Algorithm::*getter)(),
                             void (Algorithm::*setter)(int),
                             const string& help)
{
    addParam_(algo, parameter, ParamType<bool>::type, &value, readOnly,
              (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}

void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
                             double& value, bool readOnly,
                             double (Algorithm::*getter)(),
                             void (Algorithm::*setter)(double),
                             const string& help)
{
    addParam_(algo, parameter, ParamType<double>::type, &value, readOnly,
              (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}

void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
                             string& value, bool readOnly,
                             string (Algorithm::*getter)(),
                             void (Algorithm::*setter)(const string&),
                             const string& help)
{
    addParam_(algo, parameter, ParamType<string>::type, &value, readOnly,
              (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}

void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
                             Mat& value, bool readOnly,
                             Mat (Algorithm::*getter)(),
                             void (Algorithm::*setter)(const Mat&),
                             const string& help)
{
    addParam_(algo, parameter, ParamType<Mat>::type, &value, readOnly,
              (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}

void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
                             vector<Mat>& value, bool readOnly,
                             vector<Mat> (Algorithm::*getter)(),
                             void (Algorithm::*setter)(const vector<Mat>&),
                             const string& help)
{
    addParam_(algo, parameter, ParamType<vector<Mat> >::type, &value, readOnly,
              (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}

void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
                             Ptr<Algorithm>& value, bool readOnly,
                             Ptr<Algorithm> (Algorithm::*getter)(),
                             void (Algorithm::*setter)(const Ptr<Algorithm>&),
                             const string& help)
{
    addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
              (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}

}

/* End of file. */