update litris with board detection

This commit is contained in:
2023-07-29 20:54:00 +02:00
parent d3d2e1e65e
commit ffca884a25

View File

@@ -29,7 +29,7 @@ class NewStoneID(threading.Thread):
self.data_coordinates = np.zeros((20, 20), dtype=object) self.data_coordinates = np.zeros((20, 20), dtype=object)
self.fill_data_coordinates() self.fill_data_coordinates()
self.needles = {1: cv.imread("litris/blue_needle.jpg", cv.IMREAD_UNCHANGED)} self.needles = {'Q': cv.imread("litris/blue_needle.jpg", cv.IMREAD_UNCHANGED)}
self.run_mode = 'run' self.run_mode = 'run'
self.actual_letter = "" self.actual_letter = ""
@@ -76,7 +76,7 @@ class NewStoneID(threading.Thread):
screenshot = self.capture_window.get_screenshot() screenshot = self.capture_window.get_screenshot()
screenshot = screenshot[580:845, 1148:1412] screenshot = screenshot[580:845, 1148:1412]
rectangles = self.vision_stun.find(screenshot, self.needles[1], 0.85, 16) rectangles = self.vision_stun.find(screenshot, self.needles['Q'], 0.85, 16)
if len(rectangles) == 0: if len(rectangles) == 0:
return None return None
@@ -158,7 +158,7 @@ class NewStoneID(threading.Thread):
for point in points: for point in points:
x, y = self.point_in_rect(point) x, y = self.point_in_rect(point)
if x is not None and y is not None: if x is not None and y is not None:
data_coords[x][y] = int(needle_key) data_coords[x][y] = needle_key
#self.change_value(x, y, int(needle_key)) #self.change_value(x, y, int(needle_key))
# print(field.data_value_grid) # print(field.data_value_grid)
# cv.circle(screenshot, points[0], 7, (0, 255, 0), -1) # cv.circle(screenshot, points[0], 7, (0, 255, 0), -1)