opencv_contrib icon indicating copy to clipboard operation
opencv_contrib copied to clipboard

neighbor_responses and dist matrixes are not filled in KNearest/KDTree.

Open Pibben opened this issue 4 years ago • 0 comments

System information (version)
  • OpenCV => trunk
  • Operating System / Platform => any
  • Compiler => any
Detailed description

In the KDTree version of KNearest, the neighbour-response and distance matrices are not filled as the result matrix is. The result is that the neighbor_responses and dist matrices are empty after return.

opencv/modules/ml/src/knearest.cpp:

    for (int i=0; i<test_samples.rows; ++i)
    {
        Mat _res, _nr, _d;
        tr.findNearest(test_samples.row(i), k, Emax, _res, _nr, _d, noArray());
        res.push_back(_res.t());
        _results.assign(res);
    }

Pibben avatar Oct 01 '21 12:10 Pibben