MCPcopy Create free account
hub / github.com/PyImageSearch/imutils / compute

Method compute

imutils/feature/rootsift.py:17–31  ·  view source on GitHub ↗
(self, image, kps, eps=1e-7)

Source from the content-addressed store, hash-verified

15 self.extractor = cv2.xfeatures2d.SIFT_create()
16
17 def compute(self, image, kps, eps=1e-7):
18 # compute SIFT descriptors
19 (kps, descs) = self.extractor.compute(image, kps)
20
21 # if there are no keypoints or descriptors, return an empty tuple
22 if len(kps) == 0:
23 return ([], None)
24
25 # apply the Hellinger kernel by first L1-normalizing and taking the
26 # square-root
27 descs /= (descs.sum(axis=1, keepdims=True) + eps)
28 descs = np.sqrt(descs)
29
30 # return a tuple of the keypoints and descriptors
31 return (kps, descs)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected