I know and have seen tons of documentations explaining about how to capture mouse movement within a given window using mouseclick events in opencv. What I want to know is that if is there a way to capture mouse movements (x,y co-ordinates) for the entire screen of my system.
Any link, documentation or code snippet will be really helpful to proceed me with the same.
解决方案
Depending on your OS, you can do that with pyautogui like this:
#!/usr/bin/env python3
import time
import pyautogui
for i in range(10):
x, y = pyautogui.position()
print(f'Mouse position: x={x}, y={y}')
time.sleep(1)