Пример #1
0
 def __init__(self, min_diff=.5, **kw):
     super(DecisionTree, self).__init__([('opencv', 'gray', 8)],
                                        min_diff=min_diff,
                                        **kw)
     self._surf = impoint.SURF()
     self._feat = imfeat.Histogram('gray', num_bins=4, norm=False)
     self.rfc = None
Пример #2
0
 def test_name(self):
     image = cv2.imread('test_images/lena.jpg')
     b = impoint.SURF()
     s = 1
     # Compute clusters and output
     clusters = np.asfarray(imfeat.BoVW.cluster([image], b.compute_dense,
                                                8))
     f = imfeat.BoVW(lambda x: b.make_feature_mask(x, clusters), 8, 3)
     out = f(image)
     print(out.tolist())
     print(out.shape)
def camera_map(features):
    med_dists = []
    for frame_feat0, frame_feat1 in zip(features['frame_features'],
                                        features['frame_features'][1:]):
        surf0, surf1 = frame_feat0['surf'], frame_feat1['surf']
        surf_inst = impoint.SURF()
        matches = surf_inst.match(surf0, surf1)
        if 30 < len(matches) and 10 < min(len(surf0), len(surf1)):
            pairs = [
                np.asfarray([
                    surf0[x]['x'] - surf1[y]['x'],
                    surf0[x]['y'] - surf1[y]['y']
                ]) for x, y in matches
            ]
            dists = [np.linalg.norm(x) for x in pairs]
            med_dists.append(np.nan_to_num(np.median(dists)))
    sys.stderr.write('Med_dists: %d\n' % len(med_dists))
    return {'med_dists': med_dists}
Пример #4
0
 def __init__(self, max_diff=5, **kw):
     super(SURF, self).__init__(max_diff=max_diff, **kw)
     self._surf = impoint.SURF()
def _dense_surf():
    import impoint
    s = impoint.SURF()
    return s.compute_dense