OpenCV中的FLANN matcher

2024-04-20 09:20:53 发布

您现在位置:Python中文网/ 问答频道 /正文

在opencv3.1.0中,当我给出cv2.flann_索引时,它说cv2没有名为flann_Index的属性。这个功能在opencv3中有改变吗?我正在使用python3并在网上查找文档,但它们都是死胡同。 代码:

class Codebook(object):
    def __init__(self, hdffile):
        clusterf = tables.open_file(hdffile)
        self._clusters = np.array(clusterf.get_node('/clusters'))
        clusterf.close()

        self._clusterids = np.array(range(0, self._clusters.shape[0]), dtype=np.int)
        self.n_clusters = self._clusters.shape[0]

        self._flann = cv2.flann_Index(self._clusters,
                                      dict(algorithm=FLANN_INDEX_COMPOSITE,
                                           distance=FLANN_DIST_L2,
                                           iterations=10,
                                           branching=16,
                                           trees=50))

Tags: self功能index属性nparraycv2python3