Ask Your Question

Revision history [back]

use tutorials and specifcally here

import numpy as np
import cv2 as cv
# mouse callback function
def draw_circle1(event,x,y,flags,param):
    if event == cv.EVENT_LBUTTONDBLCLK:
        cv.circle(img1,(x,y),100,(255,0,0),-1)
def draw_circle2(event,x,y,flags,param):
    if event == cv.EVENT_LBUTTONDBLCLK:
        cv.circle(img2,(x,y),100,(0,255,0),-1)
# Create a black image, a window and bind the function to window
img1= np.zeros((512,512,3), np.uint8)
cv.namedWindow('image1')
cv.setMouseCallback('image1',draw_circle1)
img2 = np.zeros((512,512,3), np.uint8)
cv.namedWindow('image2')
cv.setMouseCallback('image2',draw_circle2)
while(1):
    cv.imshow('image1',img1)
    cv.imshow('image2',img2)
    if cv.waitKey(20) & 0xFF == 27:
        break
cv.destroyAllWindows()