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

Class HARRIS

imutils/feature/harris.py:6–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6class HARRIS:
7 def __init__(self, blockSize=2, apertureSize=3, k=0.1, T=0.02):
8 self.blockSize = blockSize
9 self.apertureSize = apertureSize
10 self.k = k
11 self.T = T
12
13 def detect(self, img):
14 # convert our input image to a floating point data type and then
15 # compute the Harris corner matrix
16 gray = np.float32(img)
17 H = cv2.cornerHarris(gray, self.blockSize, self.apertureSize, self.k)
18
19 # for every (x, y)-coordinate where the Harris value is above the
20 # threshold, create a keypoint (the Harris detector returns
21 # keypoint size a 3-pixel radius)
22 kps = np.argwhere(H > self.T * H.max())
23 kps = [cv2.KeyPoint(pt[1], pt[0], 3) for pt in kps]
24
25 # return the Harris keypoints
26 return kps

Callers 1

FeatureDetector_createFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…