Skip to content

Commit

Permalink
fix(single-mode): error when recognize +100
Browse files Browse the repository at this point in the history
fix #162
  • Loading branch information
NateScarlet committed Aug 23, 2021
1 parent 4a9d72c commit 15509d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Training<lv=5 spd=100 pow=57 ski=19 ptn=spd@5,wis@5,spd@5,spd@4,spd@4>
10 changes: 10 additions & 0 deletions auto_derby/single_mode/training/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ def _ocr_training_effect(img: Image) -> int:
cv2.waitKey()
cv2.destroyAllWindows()

# +100 has different color
hash100 = "0000000000006066607770ff70df60df00000000000000000000000000000000"
if (
imagetools.compare_hash(
imagetools.image_hash(imagetools.pil_image(text_img)),
hash100,
)
> 0.9
):
return 100
text = ocr.text(image_from_array(text_img))
if not text:
return 0
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 15509d6

Please sign in to comment.