import cv2 import numpy as np import zmq from recognizer import recognize def euclidian(x1, y1, x2, y2): return ((x1 - x2)**2 + (y1 - y2)**2)**0.5 cv2.namedWindow("Image", cv2.WINDOW_GUI_NORMAL) cv2.namedWindow("Image2", cv2.WINDOW_GUI_NORMAL) context = zmq.Context() socket = context.socket(zmq.SUB) socket.setsockopt(zmq.SUBSCRIBE, b"") port = 5055 socket.connect(f"tcp://192.168.0.113:{port}") n = 0 while True: bts = socket.recv() n += 1 arr = np.frombuffer(bts, np.uint8) imagege = cv2.imdecode(arr, cv2.IMREAD_COLOR) recognize(imagege, n, True) cv2.destroyAllWindows()