Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Bug in downhill_simplex?

I was attempting to use the downhill_simplex method in OpenCV for an alignment problem. However, I found that when calling DownhillSolver::minimize(x), values of x were ignored, and the algorithm always starts at zero.

Looking at the source code, I think there is a bug on line 357 in downhill_simplex.cpp:

    simplex.row(0).copyTo(proxy_x);
    // this line should be:
    // proxy_x.row(0).copyTo(simplex);
    createInitialSimplex(simplex,_step);
    double res = innerDownhillSimplex(
            simplex,_termcrit.epsilon, _termcrit.epsilon, count,_Function,_termcrit.maxCount);
    simplex.row(0).copyTo(proxy_x);

Bug in downhill_simplex?

I was attempting to use the downhill_simplex method in OpenCV for an alignment problem. However, I found that when calling DownhillSolver::minimize(x), values of x were ignored, and the algorithm always starts at zero.

Looking at the source code, I think there is a bug on line 357 in downhill_simplex.cpp:

    simplex.row(0).copyTo(proxy_x);
    // this line should be:
    // proxy_x.row(0).copyTo(simplex);
    createInitialSimplex(simplex,_step);
    double res = innerDownhillSimplex(
            simplex,_termcrit.epsilon, _termcrit.epsilon, count,_Function,_termcrit.maxCount);
    simplex.row(0).copyTo(proxy_x);