diff --git a/assigning.py b/assigning.py index 5bc4b08..7c8274f 100644 --- a/assigning.py +++ b/assigning.py @@ -1,25 +1,18 @@ import os from codes_recognizer.rocognizer import recognizer -from board import get_shelfs -def assigning(product_code_path, board, shelfs): +def assigning(product_code_path, shelfs): + c = None code = recognizer(product_code_path) - + print(code) + product_color = str(code[0]) + str(code[1]) + print(product_color) for shelf in shelfs: - if shelf.is_empty: + if shelf.color == product_color: shelf.add_product(code) - c = shelf.get_coordinates() - break - else: - if shelf.get_product() == code: - shelf.add_product(code) - c = shelf.get_coordinates() - break + c = shelf.get_field() print("Product", product_code_path, "is on", c) return c - - - diff --git a/codes_recognizer/rocognizer.py b/codes_recognizer/rocognizer.py index 8e4d4c8..097e25d 100644 --- a/codes_recognizer/rocognizer.py +++ b/codes_recognizer/rocognizer.py @@ -43,9 +43,9 @@ def recognizer(path): probab = list(ps.numpy()[0]) code.append(probab.index(max(probab))) - codes.append(code) + # cv2.imshow("Code", img) # cv2.waitKey() - return codes + return code diff --git a/data.py b/data.py index e223aed..7ec7cb4 100644 --- a/data.py +++ b/data.py @@ -71,7 +71,7 @@ learning_data = [ ['red', 'rectangle', 235, 'big', 'dr-Gerard-PryncyPalki'], ['white', 'rectangle', 25, 'medium', 'Nestle-Cini-Minis-Batonik'], ['black', 'pack', 70, 'big', 'Korsarz-Draze'], - ['white', 'rectangle', 50, 'medium', 'Góralki'], + ['white', 'rectangle', 50, 'medium', 'Goralki'], ['white', 'rectangle', 24, 'medium', 'Kinder-Country'], ['red', 'rectangle', 46, 'medium', '3Bit'], ['yellow', 'rectangle', 25, 'medium', 'Nestle-Nesquik-Batonik'], diff --git a/main.py b/main.py index dc6c3b7..1532c83 100644 --- a/main.py +++ b/main.py @@ -78,7 +78,7 @@ def run(): Wyznacza patha do polki na ktora ma polozyc produkt. ''' # list [x, y] - dest_shelf = new_product.shelf(board) + dest_shelf = new_product.shelf(shelfs) path = functions.a_star(board[agent.y][agent.x], dest_shelf.get_field(), board) '''''' diff --git a/product.py b/product.py index 4e9e521..9d6c357 100644 --- a/product.py +++ b/product.py @@ -31,6 +31,6 @@ class FinalProduct: self.img = create_image(self) - def shelf(self, board): + def shelf(self, shelfs): print(self.img) - return assigning(self.img, board); + return assigning(self.img, shelfs); diff --git a/shelf.py b/shelf.py index 7018ccb..c73d77c 100644 --- a/shelf.py +++ b/shelf.py @@ -19,11 +19,8 @@ class Shelf: else: self.level3.append(product) - def get_product(self): - return self.products[0] - def get_field(self): return self.field - - + def get_color(self): + return self.color