Changed graph construction for chinese_whispers() so that each face is always

included in the edge graph.  If it isn't then the output labels from
chinese_whispers would be missing faces in this degenerate case.  So basically this fixes a bug
where chinese_whispers(), when called from python, would sometimes return a labels array
that doesn't include labels for all the inputs.
This commit is contained in:
Davis King 2017-10-27 19:30:58 -04:00
parent dc0245af05
commit 1e877b1917

View File

@ -141,7 +141,7 @@ boost::python::list chinese_whispers_clustering(boost::python::list descriptors,
std::vector<unsigned long> labels;
for (size_t i = 0; i < num_descriptors; ++i)
{
for (size_t j = i+1; j < num_descriptors; ++j)
for (size_t j = i; j < num_descriptors; ++j)
{
matrix<double,0,1>& first_descriptor = boost::python::extract<matrix<double,0,1>&>(descriptors[i]);
matrix<double,0,1>& second_descriptor = boost::python::extract<matrix<double,0,1>&>(descriptors[j]);