Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. ix=0
  2. iy=0
  3. cropping=False
  4. refPt=[]
  5.  
  6. def draw(event, x, y, flags, param):
  7. global ix, iy, drawing, right_mouse_button, left_mouse_button, \
  8. refPt, cropping, color, thickness
  9. ix = int(x)
  10. iy = int(y)
  11.  
  12. if event == cv2.EVENT_MBUTTONDOWN:
  13. if not cropping:
  14. refPt = [(x, y)]
  15. cropping = True
  16. else:
  17. cropping = False
  18. refPt.append((x, y))
  19. cv2.rectangle(o2, refPt[0], refPt[1], color, thickness, cv2.LINE_8)
  20.  
  21. cv2.setMouseCallback('normal', draw)
  22.  
  23. o2 = cv2.rectangle (o2, (refPt[0]), (refPt[1]), (0, 255, 0), 3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement