[Numpy-discussion] converting a C bytes array to two dimensional numpy array

2019-07-16 Thread Omry Levy
Hi, I have a question, regarding conversion of C (unsigned char *) buffer to a two dimensional numpy array this is what i am doing: 1) I get a C network buffer of unsigned char * let's call it the source buffer the size of the source buffer is: W * H * 2 bytes 2) I am using PyByteArray_FromSt

[Numpy-discussion] converting 1 dimensional array to 2 dimensional array

2019-07-15 Thread Omry Levy
Hi All, I know how to reshape arrays, my problem is a little more complicated than that. I am looking for the most efficient way to do the following and an example will help: 1) I have a an array of bytes b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] This bytes array represents a width of 2 and a