加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
boss_kit.py 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
scxs1388 提交于 2021-04-19 20:30 . day17
from settings import PATH
import os
import sys
import cv2 as cv
import numpy as np
from tqdm import tqdm
bosskit_items = [
("kit_t1", os.path.join(PATH["sample_image_dir"], "kit_t1.png")),
("kit_t2", os.path.join(PATH["sample_image_dir"], "kit_t2.png")),
("kit_t3", os.path.join(PATH["sample_image_dir"], "kit_t3.png")),
("kit_t4", os.path.join(PATH["sample_image_dir"], "kit_t4.png"))
]
def bosskit_check(root_path):
res = [0, 0, 0, 0]
submit_image_dir_list = os.listdir(root_path)
threshold = 0.75
for submit_image_dir in tqdm(submit_image_dir_list):
try:
image_path = os.path.join(root_path, submit_image_dir, "boss_reward.png")
src_img = cv.imread(image_path)
# print(image_path)
for i, bosskit_item in enumerate(bosskit_items):
tpl_img = cv.imread(bosskit_item[1])
r = cv.matchTemplate(src_img, tpl_img, cv.TM_CCOEFF_NORMED)
loc = np.where(r > threshold)
if len(loc[0]) > 0:
res[i] += 1
break
except:
print(submit_image_dir)
return res
def main():
res = bosskit_check(PATH["submit_image_dir"])
print(res)
pos = [round(i / sum(res), 6) for i in res]
print(pos)
if __name__ == "__main__":
main()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化