Why I had to give up on OpenCV #7
DigitalE4rth
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The whole story started with Genshin Impact.
The Sobel and Canny edge detections did a very poor job determining the roundness of the dialogue options. So they had to be abandoned in favour of template matching.
Template matching worked fine, but I had to add a separate template image for each possible game resolution. At 1920x1080 everything worked as it should, and in 3 days of development I somehow managed to get it semi-working 90% of the time.
But it didn't work as it should for lower resolutions. This was due to game's implementation of anti-aliasing, which causes the game to blur outlines of dialogue options at lower resolutions.
In addition, dialogue options actually have 85% opacity, which is why everything had to be converted to grayscale in hopes that background color will match the template. Which still didn't work well at low resolutions. So I tried to combine several templates with different background colors into one template. And that didn't work well either. So for lower resolutions, I didn't know what else I could do with OpenCV besides training a custom model.
Furthermore, the library size is 70 MB, and although it has been rebuilt and all unused features have been removed, reducing its size to 25 MB (thanks Vobraz), this did not solve the main problem. So I wondered what else could be done.
So I decided to abandon OpenCV and try to write my own function for finding dialog options and, as a result, I built its dynamic mathematical model which was calculated from all dialog option parameters on different game screen resolutions.
And it worked just beautifully, that's why I settled on this particular solution for this game.
If you have any thoughts on this, please share. This is certainly an unusual way to solve a problem, but like Todd H. said, "It just works".
Beta Was this translation helpful? Give feedback.
All reactions