Loading modules/optflow/samples/motempl.py +6 −3 Original line number Diff line number Diff line Loading @@ -11,10 +11,11 @@ MIN_TIME_DELTA = 0.05 def nothing(dummy): pass def draw_motion_comp(vis, (x, y, w, h), angle, color): def draw_motion_comp(vis, rect, angle, color): x, y, w, h = rect cv.rectangle(vis, (x, y), (x+w, y+h), (0, 255, 0)) r = min(w/2, h/2) cx, cy = x+w/2, y+h/2 r = min(w//2, h//2) cx, cy = x+w//2, y+h//2 angle = angle*np.pi/180 cv.circle(vis, (cx, cy), r, color, 3) cv.line(vis, (cx, cy), (int(cx+np.cos(angle)*r), int(cy+np.sin(angle)*r)), color, 3) Loading Loading @@ -91,4 +92,6 @@ if __name__ == '__main__': prev_frame = frame.copy() if 0xFF & cv.waitKey(5) == 27: break # cleanup the camera and close any open windows cam.release() cv.destroyAllWindows() Loading
modules/optflow/samples/motempl.py +6 −3 Original line number Diff line number Diff line Loading @@ -11,10 +11,11 @@ MIN_TIME_DELTA = 0.05 def nothing(dummy): pass def draw_motion_comp(vis, (x, y, w, h), angle, color): def draw_motion_comp(vis, rect, angle, color): x, y, w, h = rect cv.rectangle(vis, (x, y), (x+w, y+h), (0, 255, 0)) r = min(w/2, h/2) cx, cy = x+w/2, y+h/2 r = min(w//2, h//2) cx, cy = x+w//2, y+h//2 angle = angle*np.pi/180 cv.circle(vis, (cx, cy), r, color, 3) cv.line(vis, (cx, cy), (int(cx+np.cos(angle)*r), int(cy+np.sin(angle)*r)), color, 3) Loading Loading @@ -91,4 +92,6 @@ if __name__ == '__main__': prev_frame = frame.copy() if 0xFF & cv.waitKey(5) == 27: break # cleanup the camera and close any open windows cam.release() cv.destroyAllWindows()