Ai
1 Star 1 Fork 0

零沢/AzurLaneAutoScript

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
relative_crop.py 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
LmeSzinc 提交于 2022-05-14 23:56 +08:00 . Add: Do random map events in OpSi
import os
import time
import module.config.server as server
from module.base.utils import *
server.server = 'cn' # Don't need to edit, it's used to avoid error.
from module.config.config import AzurLaneConfig
from module.map_detection.view import View
from module.base.utils import load_image
class Config:
"""
Paste the config of map file here
"""
pass
from module.os.config import OSConfig
cfg = AzurLaneConfig('alas').merge(OSConfig())
# Folder to save temp images
folder = './screenshots/relative_crop'
# Put Screenshot here
file = ''
i = load_image(file)
grids = View(cfg)
grids.load(np.array(i))
grids.predict()
grids.show()
os.makedirs(folder, exist_ok=True)
for grid in grids:
# Find more relative_crop area in module/map/grid_predictor.py
# This one is for `predict_enemy_genre`
piece = rgb2gray(grid.relative_crop((-0.5, -1, 0.5, 0), shape=(60, 60)))
file = '%s_%s_%s.png' % (int(time.time()), grid.location[0], grid.location[1])
file = os.path.join(folder, file)
Image.fromarray(piece).save(file)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/reizawa/AzurLaneAutoScript.git
git@gitee.com:reizawa/AzurLaneAutoScript.git
reizawa
AzurLaneAutoScript
AzurLaneAutoScript
master

搜索帮助