Meowcolm024 / FGO-Automata

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

fix subprocess截圖在import時會出錯,修改圖片相似度判斷,改使用最大相似度進行判斷 #46

Closed Zhen-Bo closed 3 years ago

Zhen-Bo commented 3 years ago

日版關卡模版依舊無法判斷,相似度沒法高過85%

lgtm-com[bot] commented 3 years ago

This pull request introduces 1 alert when merging ccc2b1a9f04c0aced0f2469aa52efbf73e83dec4 into b3961092532b0e91b1e33cb448c7b0464fdd0e8f - view on LGTM.com

new alerts:

Meowcolm024 commented 3 years ago

這個可能是模板圖片的問題?我負責這一part不太清楚。 至於國服的問題,我自己玩的是日服,也不太清楚XD

Zhen-Bo commented 3 years ago

了解~ 然後有些建議就是說其實util內有蠻多功能都會重複用到,像是get_crd跟standby,兩個其實可以合併,改成判斷完如果有相似度大於設定閥值的就回傳該座標,如果沒有的話就回傳false之類的 不過我懶得去看就沒改了,而且這個bot有點複雜,怕牽一髮動全身

def standby(template, acc=0.85, special=False):
    target_img = adbkit.screenshots() #target_img = adb的截圖陣列
    #特定時使用遮罩遮蔽不需要的部分
    if special == True:
        cv2.rectangle(target_img, (0, 0), (1280, 420),
                      color=(0, 0, 0), thickness=-1)
    find_img = cv2.imread(str(template))
    find_height, find_width = find_img.shape[:2:]
    # 模板匹配
    result = cv2.matchTemplate(target_img, find_img, cv2.TM_CCOEFF_NORMED)
    reslist = cv2.minMaxLoc(result)

    if reslist[1] > acc:
        return reslist[3], find_height, find_width
    else:
        return False
Meowcolm024 commented 3 years ago

哦,对了。日服的模板图片已经更正过了。

Zhen-Bo commented 3 years ago

了解,之後找個時間去測試看看 ps:進關卡建議可以使用直接點擊固定座標,然後用menu按鈕來判斷自己有沒有在關卡頁面

Malcolm Law notifications@github.com 於 2021年1月9日 週六 下午11:39寫道:

哦,对了。日服的模板图片已经更正过了。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Meowcolm024/FGO-Automata/pull/46#issuecomment-757324357, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHMQG7I74F3ZIIL5PYABUILSZB2DXANCNFSM4V2QA3IA .