Azelphur / PokemonGo-CalcyIV-Renamer

Uses adb to send fake tap events to your phone, alongside Calcy IV to automatically rename all your pokemon.
GNU General Public License v3.0
77 stars 32 forks source link

Script won't OCR after clicking IV button #1

Closed Tilde88 closed 6 years ago

Tilde88 commented 6 years ago

Greetings! I am the poster that was on youtube with the issue, where it simply continues to click the CalcyIV button over and over. Attached are 3 things:

  1. A GIF of me at the terminal, showing ADB connectivity and python pillow is installed. Additionally, shows what I see as it loops the IV button.

  2. A ZIP containing a recording of what I see on my phone. (I tried to send it direct as MP4, but it required to be a ZIP to attach).

  3. And finally, a copy-paste of what is at my terminal.

Thank you so much for this project, and even more for your assistance. I highly appreciate it :)

1

VID-20180509-WA0003.zip

output.txt

Tilde88 commented 6 years ago

Sorry, forgot to include the other GIF with python running. Here it is 2

Azelphur commented 6 years ago

Hi, I need a screenshot of your phone with the calcy IV dialog showing.

Tilde88 commented 6 years ago

Here is the screenshot... Sorry, forgot to send the main thing you asked for... screenshot_2018-05-10-07-37-11

marob commented 6 years ago

@Azelphur it's in the original zip file.

@Tilde88 it's the check_calcy_iv_img that probably tries to find pixels with predefined grey values in the wrong zone. As I've understood it, it tries to detect those grey pixels in the bottom of the screen to check if icons are there (which means CalcyIV succeeded): area Simple solution is to change y1 and y2 values, but in fact, there will still have some problems if one of those icons are "active" (with colors instead of grey). So a better solution would be to detect CalcyIV succeeded differently (I'm thinking trying to check if attack, defense and stamina icons are there).

Azelphur commented 6 years ago

@marob you are correct, that's exactly how it does it.

Detecting the Calcy IV dialog is a bit of a PITA.

Originally I was detecting the gray on one of the buttons (checking a single pixel) - this worked until my friend had a different UI scale on his phone, so the pixel wasn't in the same place.

Then I changed it to detecting the border around the Calcy IV dialog - so Calcy IV changed the border to rainbow, yay.

Then I've started using this new method searching for the colors within the box as you have shown, which I think works great but clearly needs a little tweaking in this case. I'll be running his screenshot through the calcy IV check and seeing why it fails, and then addressing the issue shortly. I imagine you're probably right and the bounding box just needs a little adjustment.

The check should still pass if one or more of the icons are active, it searches for a list of colors and as long as it finds at least one pixel with each of those colors, the check will pass. So as long as at least one of the buttons isn't active, it should be good.

Checking the defense and stamina icons probably isn't the best way to go about it, those attack/defense/health icons don't always appear, and even if they did, we'd still be using the same color detection method that I use on the icons I imagine. Searching for an image within an image is easy. Searching for a variable resolution image inside a variable resolution image, I don't know how to do that. :)

Azelphur commented 6 years ago

@Tilde88 issue was caused as your device has a software nav bar, so it pushed everything out of alignment. I just added something which should detect your nav bar and adjust everything to suit. Can you download the latest version and give it another test, and let us know if it's working now? :)

Tilde88 commented 6 years ago

Thanks guys. I have been having quite a week, and not too much time. The moment I am able to test, I will report. I want to mention one more thing @Azelphur . I use KCAL on my phone (screen color control). However, this should be post-processing. Do you expect that to have some sort of issue with the pixel detection?(i saw what you were saying about detecting colors). I guess we won't know until I try

Thank you very much, as well as @marob for your input. Hopefully I can try today :)

Azelphur commented 6 years ago

That's interesting, it could we'll do - it depends if the screenshots are effected. If the screenshots have their colour altered then it would most likely break things

marob commented 6 years ago

@Tilde88 based on the screenshot you provided, and on the code I'm currently working on for detection improving, it seems colors are not affected in the screenshot (I guess it is the same with the "night" feature that lowers blue on some phones).

Azelphur commented 6 years ago

@marob that's interesting, what are you planning to do detection wise?

Tilde88 commented 6 years ago

@Azelphur So... I downloaded the latest version. Well now when it clicks the button... It works!!! :D

Well done, sir! I cannot thank you enough!

marob commented 6 years ago

@Azelphur

I'll soon push everything to my github.

Regards