import cv2 import numpy as np
def click_event(event, x, y, flags, param): if event == cv2.EVENT_LBUTTONDOWN: blue = img[x, y, 0] green = img[x, y, 1] red = img[x, y, 2] print(blue, ' ', green, ' ', red) print(x, ' ', y)
img = np.zeros((577, 433, 3), np.uint8)
print(img.shape) cv2.imshow('image', img) cv2.setMouseCallback('image', click_event)
cv2.waitKey(0) cv2.destroyAllWindows()