Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- def draw_rectangle(event,x,y,flags,param):
- w,h =img.shape[::-1]
- if (event == cv2.EVENT_LBUTTONDOWN and x<=10 and y<=10) or (event == cv2.EVENT_LBUTTONDOWN and x>=w-10 and y>=h-10):
- img1 = cv2.rectangle(img, (200, 200), (510, 128), (0, 255, 0), 3)
- img1 = (255-img1)
- img = cv2.imread('obiekty.png',0)
- cv2.namedWindow('image')
- cv2.setMouseCallback('image',draw_rectangle)
- while(1):
- cv2.imshow('image',img)
- if cv2.waitKey(20) & 0xFF == 27:
- break
- cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement