Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. import cv2
  2.  
  3. def draw_rectangle(event,x,y,flags,param):
  4. w,h =img.shape[::-1]
  5. if (event == cv2.EVENT_LBUTTONDOWN and x<=10 and y<=10) or (event == cv2.EVENT_LBUTTONDOWN and x>=w-10 and y>=h-10):
  6. img1 = cv2.rectangle(img, (200, 200), (510, 128), (0, 255, 0), 3)
  7. img1 = (255-img1)
  8.  
  9. img = cv2.imread('obiekty.png',0)
  10. cv2.namedWindow('image')
  11. cv2.setMouseCallback('image',draw_rectangle)
  12. while(1):
  13. cv2.imshow('image',img)
  14. if cv2.waitKey(20) & 0xFF == 27:
  15. break
  16. cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement