trainer_matches.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:Yugioh-bot 作者: will7200 项目源码 文件源码
def compare_distances(self, train_img, cluster):
        # sometimes the sift algorithm matches random points on screen so therefore
        # it is necessary to determine the euclidean distances between these points
        distances = euclidean_distances([self.kmeans.cluster_centers_[0]], cluster)
        height, width = train_img.shape
        new_cluster = []
        # If all the points are greater than np.sqrt((width / 2) ** 2 + (height / 2) ** 2)
        # Which then we can assume that they are not correct
        # this will only work on images that fit the same dimensions against the query image
        for index, distance in enumerate(distances[0]):
            if distance <= np.sqrt((width / 2) ** 2 + (height / 2) ** 2):
                new_cluster.append(cluster[index])
        return new_cluster
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号