Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(computer vision, teserract/OpenCV lib for different server issue) Two issue of CN REGULAR #75

Open
TW-Raino opened this issue Sep 29, 2018 · 17 comments
Assignees

Comments

@TW-Raino
Copy link

  1. The script would stop after Refill.
    --> Add command [NotJPserverForStaminaRefillExtraClick = 1] can fix this issue.

  2. The Strategy of select card didn't work well.
    --> I think the function checkCardAffin and checkCardType couldn't recognize card correctly.

@TW-Raino TW-Raino changed the title Two of CN REGULAR Two issue of CN REGULAR Sep 29, 2018
@29988122
Copy link
Owner

--> Add command [NotJPserverForStaminaRefillExtraClick = 1] can fix this issue.
看來國服改版行為跟上其他服了,確實這條該拿掉

--> I think the function checkCardAffin and checkCardType couldn't recognize card correctly.
難辦,國服的字體三天一小改五天一大改,挺難跟上....
您有空的話幫我多拍幾張選卡畫面,越多越好,沒有經過縮圖的螢幕截圖,要Buster, Arts, Quick, Resist Buster, Resist Arts, Resist Quick, Weak Buster, Weak Arts, Weak Resist都有的,從者不拘

我再來看看要怎麼修復,不然我國服沒有帳號很難測... QQ

@TW-Raino
Copy link
Author

TW-Raino commented Sep 30, 2018 via email

@29988122
Copy link
Owner

我不確定能不能行,因為Ankulua的天限,還有這字實在太小了,辨識不是挺管用

目前新的comment
d7a58bc
改了weak和resist的圖,Buster/Arts/Quick還沒動。您先測測看看行為與想像的吻不吻合。

==
如果不行,我們可能要另尋辨識良方,會花不少時間。
問題在於中文字筆畫多,1280*720只是單純pixel by pixel比對相似度的錯誤可能性太大了。

或許我去看看teserract/open cv之類的是怎麽實作灰階的圖像辨識吧...

@29988122 29988122 added the bug label Sep 30, 2018
@TW-Raino
Copy link
Author

TW-Raino commented Sep 30, 2018 via email

@29988122
Copy link
Owner

29988122 commented Oct 1, 2018

其實我一開始有想過這樣做,但是他那個weak/resist的圖案會上下飄,同時卡片字樣也會跟著飄

雖然就算有飄,跟您說的一樣,如果用rgb來判斷的話,感覺多試幾次多觀察一下,應該也是可以找到一點,該點在漂移最低點<=Y pos<=漂移最高點,的區間都只有卡片顏色的紅藍綠,而不是字樣或是servant頭像的

不過這樣還是沒法解決weak/resist/克制/抵抗的伺服器語系字樣判斷問題..所以我才在想應該有更好更快的解法,想說找到再來一次處理,但是目前不知道該從何下手QQ

~
不知道您有沒有頭緒?畢竟我也沒有CN帳號不好測,如果您願意送個PR來改善圖形辨識的準確度,刷箱中的master們應該都會感謝您的 XD

@29988122 29988122 self-assigned this Oct 1, 2018
@TW-Raino
Copy link
Author

TW-Raino commented Oct 1, 2018 via email

@potchy
Copy link
Collaborator

potchy commented Oct 14, 2018

I have no idea what you guys are talking about, but see #46 and #50. Maybe it's the same problem.

@ryuga93
Copy link
Collaborator

ryuga93 commented Oct 15, 2018

Basically CN server has a preference of changing the font regularly, making region recognition harder. One solution is to change it to point recognition.

@PokeGuys
Copy link

PokeGuys commented Oct 20, 2018

我不確定能不能行,因為Ankulua的天限,還有這字實在太小了,辨識不是挺管用

目前新的comment
d7a58bc
改了weak和resist的圖,Buster/Arts/Quick還沒動。您先測測看看行為與想像的吻不吻合。

==
如果不行,我們可能要另尋辨識良方,會花不少時間。
問題在於中文字筆畫多,1280*720只是單純pixel by pixel比對相似度的錯誤可能性太大了。

或許我去看看teserract/open cv之類的是怎麽實作灰階的圖像辨識吧...

OpenCV Object Extraction

Ankulua is already using OpenCV matchTemplate (You can decompile their APK and find the Imgproc.java). The only difference is maybe it can solve the scaling problem through python script. Or using the edge detection to identify the object. Compared to classic matchTemplate, it seems better and more accurate.

Method Comparison

weak_identifier_comparison

The demo is running under python script, but using the same method as Ankulua

Tesseract 4

And also, due to the resolution of FGO, it is too small and too many noises next to word for Tesseract. It required a lots of preprocessing work before you can truly apply any OCR on it. (But I am using it to OCR the quest name and return the best matched info through the API tho)

Summary

So, I agree that recognizing the triangle is way more better than OCR.

btw, I am considering to build an API to process all the data and pass it back to the script to enhance the performance. It only takes about 50-100ms which is about 50-70x faster than the smartphone.

potchy added a commit that referenced this issue Oct 22, 2018
@potchy
Copy link
Collaborator

potchy commented Oct 22, 2018

@TW-Raino
Please try the latest commit to see if it solves the issue.

@PokeGuys
Frankly speaking, I have no experience whatsoever with the libraries you mentioned. 😅

While I do appreciate your ideas, I feel like this this project should be kept free from 3rd party APIs and network calls, so people with slow internet connections (myself included) don't experience subpar performance.

If you do come up with something handy, please open an issue/pull request or message us so we can take a look at it. As seen here, there are some functions in AnkuLua for making HTTP GET and POST calls. I'm not sure if it possible to upload screenshots this way, but I hope it helps you somehow.

@PokeGuys
Copy link

@potchy
I think the API should deploy by the user and it should be connected locally (Nox <-> Ankulua <-> API). 🤔 And yes, it can pass the file through HTTP GET / POST request. I have already write this part.

Anyway, I will open another issue and explain it in detail.

@TW-Raino
Copy link
Author

Hi, All

  1. CN was update GUI at 10/24 so some image couldn't recognized now.
    I update some image to fixed it.

battle
result
weak

  1. I also try to update the image of card type image(art / buster / quick ) but Ankulua could not distinguish between A card and B card.

@potchy
Copy link
Collaborator

potchy commented Oct 25, 2018

  1. Thanks, I already replied you in Not working on latest CN apk 1.36.0 #84.
  2. I updated weak.png and resist.png 3 days ago. I'm still waiting for confirmation whether issue was solved or not.

@Xianbei233
Copy link
Contributor

so far so good, but maybe the card choice has some issue(not actually follow the BAQ, but is always what i want to choose

@potchy
Copy link
Collaborator

potchy commented Nov 5, 2018

Unfortunately, I don't play the CN server, so I can't say why it's not working.
It would be nice if you could record a video showing the problem or provide a transfer code for a dummy account so I can do a bit of testing for myself.

@Xianbei233
Copy link
Contributor

@potchy
Copy link
Collaborator

potchy commented Nov 7, 2018

I finally managed to create an account in the CN server.
Try my latest commit to see if it's finally working for everyone.

https://streamable.com/y1red

@29988122 29988122 closed this as completed Dec 1, 2018
@29988122 29988122 reopened this Dec 1, 2018
@29988122 29988122 added this to Low priority in Bugs Dec 24, 2018
@29988122 29988122 moved this from Low priority to High priority in Bugs Dec 24, 2018
@29988122 29988122 added enhancement and removed bug labels Dec 24, 2018
@29988122 29988122 changed the title Two issue of CN REGULAR (Computer version, teserract lib for different server issue) Two issue of CN REGULAR Dec 24, 2018
@29988122 29988122 changed the title (Computer version, teserract lib for different server issue) Two issue of CN REGULAR (computer vision, teserract/OpenCV lib for different server issue) Two issue of CN REGULAR Dec 24, 2018
@29988122 29988122 removed this from High priority in Bugs Dec 24, 2018
@29988122 29988122 added this to To do in Enhancements Dec 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Enhancements
  
Requests (unassigned)
Development

No branches or pull requests

6 participants