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

Method update

官方samples/mosse.py:84–102  ·  view source on GitHub ↗
(self, frame, rate = 0.125)

Source from the content-addressed store, hash-verified

82 self.update(frame)
83
84 def update(self, frame, rate = 0.125):
85 (x, y), (w, h) = self.pos, self.size
86 self.last_img = img = cv2.getRectSubPix(frame, (w, h), (x, y))
87 img = self.preprocess(img)
88 self.last_resp, (dx, dy), self.psr = self.correlate(img)
89 self.good = self.psr > 8.0
90 if not self.good:
91 return
92
93 self.pos = x+dx, y+dy
94 self.last_img = img = cv2.getRectSubPix(frame, (w, h), self.pos)
95 img = self.preprocess(img)
96
97 A = cv2.dft(img, flags=cv2.DFT_COMPLEX_OUTPUT)
98 H1 = cv2.mulSpectrums(self.G, A, 0, conjB=True)
99 H2 = cv2.mulSpectrums( A, A, 0, conjB=True)
100 self.H1 = self.H1 * (1.0-rate) + H1 * rate
101 self.H2 = self.H2 * (1.0-rate) + H2 * rate
102 self.update_kernel()
103
104 @property
105 def state_vis(self):

Callers 4

__init__Method · 0.95
tracker.pyFile · 0.45
video_threaded.pyFile · 0.45
runMethod · 0.45

Calls 3

preprocessMethod · 0.95
correlateMethod · 0.95
update_kernelMethod · 0.95

Tested by

no test coverage detected