I'm struggling with a problem to send a cv2 videostream (webcam) to a server (which shall be used later for face recognition).
I keep getting the following error for the server:
Traceback (most recent call last):File "server.py", line 67, in <module>small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
cv2.error: OpenCV(4.6.0) :-1: error: (-5:Bad argument) in function 'resize'
> Overload resolution failed:
> - src data type = 18 is not supported
> - Expected Ptr<cv::UMat> for argument 'src'
The server looks like this:
if client_socket:while True:packet = client_socket.recv(4 * 1024)frame = np.array(packet)small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)rgb_small_frame = small_frame[:, :, ::-1]
And here's the client:
while True:vid = cv2.VideoCapture(0)while vid.isOpened():time.sleep(0.5)img, frame = vid.read()frame = imutils.resize(frame, 4 * 1024)a = pickle.dumps(frame)message = struct.pack("Q", len(a)) + atry:client_socket.sendall(message)except Exception as e:print(e)raise Exception(e)
Anyone any idea?
As it's a data stream of bytes, I tried to include for instance the sleep function to allow for more processing. Also tried to isolate the client's picture but also got errors.