我有先前集群的向量和当前集群的向量。一个簇有一个 2D Point2F 的向量,我想根据每个簇之间的距离向上排序这些簇,它存储在距离向量中,或者你能建议一个更好的方法来排序簇向量吗?
distances.resize(previousClusters.size()*currentClusters.size());
for (int i=0; i<previousClusters.size()*currentClusters.size(); i++)
{
distances[i].resize(previousClusters.size()*currentClusters.size());
}
for (int i=0; i< previousClusters.size(); i++)
{
for(int j=0; j < currentClusters.size(); j++)
{
distances[i][j] = cv::norm(previousClusters[i].m_Properties.m_Center - currentClusters[j].m_Properties.m_Center );
}
}