menti words init
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import cv2 as cv
|
||||
import numpy as np
|
||||
import pydirectinput
|
||||
|
||||
from nltk.corpus import words
|
||||
from utils import mse
|
||||
from game_base_class import GameBase
|
||||
import random
|
||||
@@ -51,9 +51,30 @@ class MentiWords(GameBase):
|
||||
|
||||
'W': cv.imread("menti_words/w.jpg", cv.IMREAD_COLOR)
|
||||
|
||||
}
|
||||
self.masks = {
|
||||
'A': cv.imread("menti_words/a-mask.png", cv.IMREAD_COLOR),
|
||||
'B': cv.imread("menti_words/b-mask.png", cv.IMREAD_COLOR),
|
||||
'C': cv.imread("menti_words/c-mask.png", cv.IMREAD_COLOR),
|
||||
'D': cv.imread("menti_words/d-mask.png", cv.IMREAD_COLOR),
|
||||
'E': cv.imread("menti_words/e-mask.png", cv.IMREAD_COLOR),
|
||||
'F': cv.imread("menti_words/f-mask.png", cv.IMREAD_COLOR),
|
||||
|
||||
'H': cv.imread("menti_words/h-mask.png", cv.IMREAD_COLOR),
|
||||
'I': cv.imread("menti_words/i-mask.png", cv.IMREAD_COLOR),
|
||||
|
||||
'L': cv.imread("menti_words/l-mask.png", cv.IMREAD_COLOR),
|
||||
'M': cv.imread("menti_words/m-mask.png", cv.IMREAD_COLOR),
|
||||
'N': cv.imread("menti_words/n-mask.png", cv.IMREAD_COLOR),
|
||||
'O': cv.imread("menti_words/o-mask.png", cv.IMREAD_COLOR),
|
||||
'P': cv.imread("menti_words/p-mask.png", cv.IMREAD_COLOR),
|
||||
|
||||
'R': cv.imread("menti_words/r-mask.png", cv.IMREAD_COLOR),
|
||||
'S': cv.imread("menti_words/s-mask.png", cv.IMREAD_COLOR),
|
||||
'T': cv.imread("menti_words/t-mask.png", cv.IMREAD_COLOR),
|
||||
'U': cv.imread("menti_words/u-mask.png", cv.IMREAD_COLOR),
|
||||
|
||||
'W': cv.imread("menti_words/w-mask.png", cv.IMREAD_COLOR)
|
||||
|
||||
}
|
||||
|
||||
@@ -62,6 +83,7 @@ class MentiWords(GameBase):
|
||||
|
||||
with open("menti_dic") as file:
|
||||
self.word_list = [line.rstrip() for line in file]
|
||||
self.word_list2 = words.words()
|
||||
|
||||
def reset_lists(self):
|
||||
self.current_letters = []
|
||||
@@ -98,17 +120,18 @@ class MentiWords(GameBase):
|
||||
|
||||
def get_current_board_state(self):
|
||||
|
||||
#screenshot = cv.imread("menti_words/screenshot.jpg")
|
||||
screenshot = self.capture_window.get_screenshot()
|
||||
screenshot = cv.imread("menti_words/screenshot.jpg")
|
||||
#screenshot = self.capture_window.get_screenshot()
|
||||
screenshot = screenshot[870:1270, 1080:1480]
|
||||
|
||||
#cv.imshow("screenshot", screenshot)
|
||||
#cv.waitKey(150)
|
||||
cv.imshow("screenshot", screenshot)
|
||||
cv.waitKey(150)
|
||||
#continue
|
||||
for needle_key in self.needles.keys():
|
||||
# gray_needle = cv.cvtColor(self.needles[needle_key], cv.COLOR_BGR2GRAY)
|
||||
# thresh_needle = cv.threshold(gray_needle, 0, 255, cv.THRESH_BINARY_INV + cv.THRESH_OTSU)[1]
|
||||
rectangles = self.vision_stun.find(screenshot, self.needles[needle_key], 0.85, 56)
|
||||
#rectangles = self.vision_stun.find(screenshot, self.needles[needle_key], 0.85, 56)
|
||||
rectangles = self.vision_stun.find(screenshot, self.needles[needle_key], 0.95, 1 ,True, self.masks[needle_key])
|
||||
if len(rectangles) == 0:
|
||||
continue
|
||||
points = self.vision_stun.get_click_points(rectangles)
|
||||
|
||||
Reference in New Issue
Block a user