Hi Group
I want to send image data between C++ and Python websockets. I use in both cases QtWebSockets and protobuf. My message looks like that:
message Image {
bytes data = 1;
int32 width = 2;
int32 height = 3;
int32 channels = 4;
}
In the C++ side I use the following code to create the stream:
byteArray.resize(proto_image.ByteSize());
ret = proto_image.SerializeToArray(byteArray.data(), byteArray.size());
and use the sendBinaryMessage of the websockets to send the message.
In the Python side I use the following out of QtPy5:
def processBinaryMessage(self, message):
image = projectname_pb2.Image()
image.ParseFromString(message)
which works fine. If I print image.width I get the correct width. However I am not sure how to further process the image data image.data, for example to put it into a np.array or show it with matplotlib. Any Hints?
Thank you for your help
Best