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

Method draw_state

官方samples/mosse.py:116–125  ·  view source on GitHub ↗
(self, vis)

Source from the content-addressed store, hash-verified

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)

Callers 1

runMethod · 0.80

Calls 1

draw_strFunction · 0.90

Tested by

no test coverage detected