I send images to sockets from a camera that launches wince :( Images in a camera are just floating point arrays created using realloc for a given size x * y
On the other hand, I get these images in python. This code works for me
img_dtype = np.float32 img_rcv = np.empty((img_y, img_x), dtype = img_dtype) p = sck.recv_into(img_rcv, int(size_bytes), socket.MSG_WAITALL) if size_bytes != p: print "Mismatch between expected and received data amount" return img_rcv
I'm a little confused about how numpy creates its arrays, and I wonder if this img_rcv is compatible with the way recv_into works.
My questions:
- How safe is it?
- Will the memory allocation for the numpy array for recv_into be known?
- Are numpy array creation procedures equivalent to malloc?
- Does it just work because I'm lucky?
source share