I want to send and receive image from cv2.Videocapture using WebSocket.
It could get json, but it couldn't decoded.
We need result that can be opened using cv2.imshow().
Somebody help me...
This is Client
ret, image_np = cap.read()
IMAGE_SHAPE = image_np.shape
encoded_image = base64.b64encode(image_np)
print(type(encoded_image))
payload = {
'from': 'rasp',
'image': str(encoded_image),
'shape': IMAGE_SHAPE,
}
data = json.dumps(payload)
try:
# Send encoded image data.
await websocket.send(data)
# receive server message
received_data = await websocket.recv()
print('< {}'.format(received_data))
# image = base64.b64decode(received_data)
<