Hi, I have a code such that when I click on an image it gives me the x and y coordinates. I also want it to draw a small dot/circle at the place where I clicked.
Can someone help, please?
Thanks!
import cv2
import numpy as np
[print(i) for i in dir(cv2) if 'EVENT' in i]
# importing the module
import cv2
xcoor = [0]
ycoor = [0]
# function to display the coordinates of
# of the points clicked on the image
# point_matrix = np.zeros((2,2),np.int)
# counter = 0
def click_event(event, x, y, flags, params):
# checking for left mouse clicks
#global counter
if event == cv2.EVENT_LBUTTONDOWN:
# point_matrix[counter] = x, y
# counter = counter + 1
# for x in range(0, 2):
# cv2.circle(img, (point_matrix[x][0], point_matrix[x][1]), 3, (0, 255, 0), cv2.FILLED)
# displaying the coordinates
# on the Shell
print("------------------------")
print(x, ' ', y)
xcoor.append(x)
ycoor.append(y)