Pillow librairy python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Pillow librairy python

Hey guys In python we have a librairy called pillow or PIL and there's something called .getpixel. My question is, is there anyway i can automatically move to certain pixels using pyautogui? for example. you have an image and u print the color pixels to ur terminal. Even if u move the picture around to a whole different place but still on ur screen, the computer can still find it and move to the pixels. Think about it as a video where the pixels are moving, but ur mouse keeps following it. I hope that makes any sense.

11th Aug 2019, 12:52 PM
Jordi
Jordi - avatar
2 Answers
+ 2
The technique you are looking for is video/image stabilization. I suggest something like this. Instead of tracking only 1 pixel, it is better to track a group of pixels for better accuracy. Say, track a window of size 3x3 or 5x5 instead. Every 10ms, scan the neighbor region of size 15x15, check if the window is there. If you find the window, move the mouse cursor there, else, open the scan region to 30x30, then 45x45, 60x60, and so on if the program cannot find the window. The rationale behind this is that you don't want to scan through the full screen of 1920x1080 pixels and instead, keep the search region small to speed up the searching, making real-time tracking possible. Of course, if you don't want to reinvent the wheels yourself, go look for video stabilization technique for python.
16th Aug 2019, 8:30 PM
Gloria Borger
Gloria Borger - avatar
0
i found something that i'm kinda looking for, but it still uses a picture for reference, and it's too slow. i'll look into image stabilization. Thank you
17th Aug 2019, 11:29 AM
Jordi
Jordi - avatar