added async stone detection thread

This commit is contained in:
2023-07-25 09:47:52 +02:00
parent 8049e58e71
commit b570813c5a
2 changed files with 5 additions and 6 deletions

View File

@@ -1,5 +1,3 @@
from copy import copy
import cv2 as cv
import numpy as np
from game_base_class import GameBase
@@ -11,6 +9,7 @@ from litris_stone_id_thread import NewStoneID
from window_capture import WindowCapture
from vision import Vision
from config_file import UserConfigs
class Litris(GameBase):
def __init__(self, overlay):
@@ -37,7 +36,7 @@ class Litris(GameBase):
self.litris_reset_board = cv.imread("control_elements/sodoku_reset_button.jpg", cv.IMREAD_COLOR)
self.stone_id_thread = NewStoneID()
self.stone_id_thread = NewStoneID(self.capture_window)
self.move_mode = 1

View File

@@ -18,11 +18,11 @@ Z_FULL = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1], [0, 0, 0, 0]]
T_FULL = [[0, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 0], [0, 0, 0, 0]]
class NewStoneID(threading.Thread):
def __init__(self):
def __init__(self, cap_win):
threading.Thread.__init__(self)
self.config = UserConfigs()
self.capture_window = WindowCapture(None, None, self.config)
#self.config = UserConfigs()
self.capture_window = cap_win
self.vision_stun = Vision()
self.stone_coordinates = np.zeros((4, 4), dtype=object)