Fix: Research status parsing on low quality image

This commit is contained in:
LmeSzinc 2022-12-29 22:17:17 +08:00
parent 40d443433b
commit 1b918f1785
2 changed files with 4 additions and 4 deletions

View File

@ -119,7 +119,7 @@ class ResearchQueue(ResearchUI):
center = button.crop((7, 7, 21, 21))
if self.image_color_count(center, color=(255, 158, 57), threshold=180, count=20):
return 'finished'
if self.image_color_count(center, color=(90, 97, 132), threshold=221, count=20):
if self.image_color_count(center, color=(90, 97, 132), threshold=221, count=10):
return 'waiting'
if self.image_color_count(center, color=(24, 24, 41), threshold=221, count=10):
below = button.crop((7, 14, 21, 21))

View File

@ -94,11 +94,11 @@ class ResearchUI(UI):
for index, status, scaling in zip(range(5), RESEARCH_STATUS, TEMPLATE_SCALING):
info = status.crop((0, -40, 200, 0))
piece = rgb2gray(crop(image, info.area))
if TEMPLATE_WAITING.match(piece, scaling=scaling):
if TEMPLATE_WAITING.match(piece, scaling=scaling, similarity=0.75):
out.append('waiting')
elif TEMPLATE_RUNNING.match(piece, scaling=scaling):
elif TEMPLATE_RUNNING.match(piece, scaling=scaling, similarity=0.75):
out.append('running')
elif TEMPLATE_DETAIL.match(piece, scaling=scaling):
elif TEMPLATE_DETAIL.match(piece, scaling=scaling, similarity=0.75):
out.append('detail')
else:
out.append('unknown')