Skip to content

Commit

Permalink
fix(single-mode): update templates
Browse files Browse the repository at this point in the history
fix #232
fix #233
fix #234
  • Loading branch information
NateScarlet committed Feb 18, 2022
1 parent c3a2289 commit ed22a30
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hasHealthCare": false,
"hasScheduledRace": false,
"canGoOutWithFriend": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hasHealthCare": false,
"hasScheduledRace": false,
"canGoOutWithFriend": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"date": [
1,
0,
0
],
"mood": [
1.2,
1.1
],
"scenario": "新設! URAファイナルズ!!",
"vitality": 0.6376811594202898,
"maxVitality": 100,
"speed": 217,
"stamina": 237,
"power": 218,
"guts": 106,
"wisdom": 149,
"fanCount": 0,
"turf": "",
"dart": "",
"sprint": "",
"mile": "",
"intermediate": "",
"long": "",
"last": "",
"middle": "",
"head": "",
"lead": "",
"condition": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"date": [
1,
0,
0
],
"mood": [
1.0,
1.0
],
"scenario": "アオハル杯~輝け、チームの絆~",
"vitality": 0.34782608695652173,
"maxVitality": 100,
"speed": 250,
"stamina": 155,
"power": 206,
"guts": 108,
"wisdom": 95,
"fanCount": 0,
"turf": "",
"dart": "",
"sprint": "",
"mile": "",
"intermediate": "",
"long": "",
"last": "",
"middle": "",
"head": "",
"lead": "",
"condition": 0
}
Binary file modified auto_derby/templates/single_mode_command_go_out.pos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified auto_derby/templates/single_mode_formal_race_banner.pos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified auto_derby/templates/single_mode_race_menu_fan_icon.pos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified auto_derby/templates/single_mode_ura_finals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified auto_derby/templates/single_mode_ura_finals.pos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions scripts/capture_template_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def _latest_file():
)


def create_pos_mask(name: Text, game_img: PIL.Image.Image, threshold: float):
def create_pos_mask(
name: Text, game_img: PIL.Image.Image, threshold: float, padding: int
):
template.g.screenshot_width = game_img.width
pos_name = template.add_middle_ext(name, "pos")
pos_img = template.try_load(pos_name)
Expand All @@ -46,7 +48,6 @@ def create_pos_mask(name: Text, game_img: PIL.Image.Image, threshold: float):
else:
out_img = np.zeros((960, 540), dtype=np.uint8)

padding = 2
for _, pos in template.match(
game_img, template.Specification(name, templates.ANY_POS, threshold=threshold)
):
Expand All @@ -71,19 +72,21 @@ def main():
"--game-image", "-g", dest="game_image", default="debug/last_screenshot.png"
)
parser.add_argument("--threshold", "-t", dest="threshold", type=float, default=0.9)
parser.add_argument("--padding", "-p", dest="padding", type=int, default=2)
parser.add_argument("--debug", "-d", action="store_true")
args = parser.parse_args()
name = args.name
if args.debug:
template._DEBUG_TMPL = name # type: ignore
threshold = args.threshold
padding = args.padding
game_image_path = args.game_image
if not name:
name = _latest_file()
game_image = imagetools.resize(
PIL.Image.open(game_image_path), width=template.TARGET_WIDTH
)
create_pos_mask(name, game_image, threshold)
create_pos_mask(name, game_image, threshold, padding)


if __name__ == "__main__":
Expand Down

0 comments on commit ed22a30

Please sign in to comment.