| 114 | return vis |
| 115 | |
| 116 | def draw_state(self, vis): |
| 117 | (x, y), (w, h) = self.pos, self.size |
| 118 | x1, y1, x2, y2 = int(x-0.5*w), int(y-0.5*h), int(x+0.5*w), int(y+0.5*h) |
| 119 | cv2.rectangle(vis, (x1, y1), (x2, y2), (0, 0, 255)) |
| 120 | if self.good: |
| 121 | cv2.circle(vis, (int(x), int(y)), 2, (0, 0, 255), -1) |
| 122 | else: |
| 123 | cv2.line(vis, (x1, y1), (x2, y2), (0, 0, 255)) |
| 124 | cv2.line(vis, (x2, y1), (x1, y2), (0, 0, 255)) |
| 125 | draw_str(vis, (x1, y2+16), 'PSR: %.2f' % self.psr) |
| 126 | |
| 127 | def preprocess(self, img): |
| 128 | img = np.log(np.float32(img)+1.0) |