Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
据我所知,knn 找到所有样本的最小距离。这意味着它是最近的样本。但是如果我想要我的新数据与所有样本的距离怎么办?例如,如何获得与我的新数据最近的 3 或 4 个样本?谢谢
K 最近邻?这意味着您可以找到 K 个最近的样本。您应该仔细阅读文档。例子:
kdtree.knnSearch(((cv::Mat)objects_coordinates[i_pts]).t(), indices, dists, num_of_neighbours, cv::flann::SearchParams(32));