+ 1

How to get the coordinates of an element in a Screenshot with python using OpenCv module?

To be more precise, I want to get the coordinates of an element that could be (an image inside an image) or an element that I would define for example the coordinates of the sun in the picture, etc.. So how I want to proceed is taking a Screenshot And using the module OpenCv to detect the element and make a program to get the coordinates. ( If you know other modules to do my request there is no problem but it has to be in python) I Know that there are some pre-made functions to get the coordinates but I don't know how to do this altogether. If someone could help me with this problem I would be very grateful. Thank you for your time! Have a great day! Edit : Don't forget to +1 to help me even if you don't reply.

9th Feb 2021, 4:36 AM
Maximilien
Maximilien  - avatar
4 odpowiedzi
+ 2
Just use pyautogui.locateCenterOnScreen("/path/to/screen/shot/") it returns the coordinates of the picture if its on the screen hope this helps cause i dont know anything about open CV
9th Feb 2021, 1:31 PM
Ireneo language
+ 1
Thank you, I will try this and let you know :)
9th Feb 2021, 3:09 PM
Maximilien
Maximilien  - avatar
+ 1
Yeah it works perfectly fine thank you very much!!
10th Feb 2021, 12:02 AM
Maximilien
Maximilien  - avatar
0
Anytime
10th Feb 2021, 12:37 AM
Ireneo language