Meowcolm024 / FGO-Automata

一个FGO脚本和API フェイトグランドオーダー自動化
https://meowcolm024.github.io/FGO-Automata/
MIT License
120 stars 34 forks source link

Low accuray recognizing battle id #19

Closed yztxwd closed 4 years ago

yztxwd commented 4 years ago

First, great project, thanks! But I found some problems when using automatic battle, the source of these problems are usually caused by failure to interpret battle id, and I tried adding grayscale/binary conversion to solve the problem, now it works well.

for core.util get_battle_id function: Replace

    text = image_to_string(
        region, config='--psm 7 --oem 3 -c tessedit_char_whitelist=/1234')

to

    THRESHOLD = 200
    BINARY_TABLE=[0 if i < THRESHOLD else 1 for i in range(256)]
    text = image_to_string(
        region.convert('L').point(BINARY_TABLE, '1'), config='--psm 7 --oem 3 -c tessedit_char_whitelist=/1234')
Meowcolm024 commented 4 years ago

Great, thanks a lot. I would fix it , but I can't test it right now... maybe future testing is required. Besides, feel free to enhance these features and raising pull requests :)