MCPcopy
hub / github.com/makelove/OpenCV-Python-Tutorial / correlate

Method correlate

官方samples/mosse.py:132–141  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

130 return img*self.win
131
132 def correlate(self, img):
133 C = cv2.mulSpectrums(cv2.dft(img, flags=cv2.DFT_COMPLEX_OUTPUT), self.H, 0, conjB=True)
134 resp = cv2.idft(C, flags=cv2.DFT_SCALE | cv2.DFT_REAL_OUTPUT)
135 h, w = resp.shape
136 _, mval, _, (mx, my) = cv2.minMaxLoc(resp)
137 side_resp = resp.copy()
138 cv2.rectangle(side_resp, (mx-5, my-5), (mx+5, my+5), 0, -1)
139 smean, sstd = side_resp.mean(), side_resp.std()
140 psr = (mval-smean) / (sstd+eps)
141 return resp, (mx-w//2, my-h//2), psr
142
143 def update_kernel(self):
144 self.H = divSpec(self.H1, self.H2)

Callers 1

updateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected