(self, frame, rate = 0.125)
| 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): |
no test coverage detected