(self, image, kps, eps=1e-7)
| 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) |
nothing calls this directly
no outgoing calls
no test coverage detected