25 lines
439 B
Python
Executable File
25 lines
439 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import cv2
|
|
import numpy as np
|
|
|
|
mouse_raw = (0, 0)
|
|
|
|
def clickEvent(event, x, y, flags, params):
|
|
global mouse_raw
|
|
|
|
if event == cv2.EVENT_LBUTTONDOWN:
|
|
mouse_raw = (x, y)
|
|
print(mouse_raw)
|
|
|
|
cap = cv2.VideoCapture(0)
|
|
cv2.namedWindow("image")
|
|
cv2.setMouseCallback("image", clickEvent)
|
|
|
|
while True:
|
|
success, img = cap.read()
|
|
cv2.imshow("image", img)
|
|
cv2.waitKey(0)
|
|
|
|
cv2.destroyAllWindows()
|