D
D
Darvel2020-09-18 03:00:11
Python
Darvel, 2020-09-18 03:00:11

How to do image search with different text in python?

Hello. You need to find the picture in the game and click on it. I already did this through the pyautogui.locateOnScreen function, I also tried it through OpenCV, but I couldn’t set the accuracy there and it often doesn’t find it. Now I have moved to another object, where the text is in a black frame, the text is different, it happens from 1, 2 and 3 words and of different lengths. Tell me how this can be implemented? Examples of pictures:
5f63f7f5ddb55697506433.png
5f63f7fb17769024121013.png
5f63f84e129f1880664275.png
I tried to smear the text in Photoshop and search for such a picture with reduced accuracy, but either it doesn’t find it, or it only finds the original, and we approach another entrance with a longer or shorter inscription and that’s it, it doesn’t recognize it anymore.
PS The meaning is this - we run the second window behind the main one, moving along the cross on the map, when the cross disappeared - we poke on the passage nearby, which is indicated only by the inscription, and is highlighted only when hovering, do not crawl with the mouse all over the screen until the passage lights up .. Well, there the form is different, I'm not sure that it will always find it, although the option, the current xs how to do it right .. The glow is stupidly white. When you hover over the passage with the mouse, it looks like this:
5f63fa9bb966f975607886.png
Another option is to use tensorflow and train to recognize different rectangles with text, but I couldn’t figure out how to pre-train the network and how to connect the network to recognition and whether it will be in time, although it’s just a rectangle to find, but not a complex object.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2020-09-18
@dimonchik2013

https://www.pyimagesearch.com/2018/08/20/opencv-te...

R
Roman Mirilaczvili, 2020-09-18
@2ord

Apply:
1. Erode
2. Corner Detection
Based on the obtained coordinates, select those that are closer to the center of the image and form a rectangle.
Then

click on it

If I understand correctly, you do not need to define the text. And the easier it is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question