[PYTHON MATRIX-SIG] NumPy and PIL extension module
Zachary_Roadhouse@brown.edu
Zachary_Roadhouse@brown.edu
Mon, 05 May 1997 22:01:01 -0400 (EDT)
Okay, taking a crack at it. Does this do what I want it too (copy the
data from the image which is char** to the array which is int*)?
array = PyArray_FromDims(2,dims,PyArray_INT);
i_ptr = (int*)array->data;
for (yy = 0; yy < array->dimensions[0]; ++yy) {
for(xx = 0; xx < array->dimensions[1]; ++xx)
ptr[xx] = im->image8[yy][xx];
ptr += array->dimensions[1];
}
return PyArray_Return(array);
- Zack
E-MAIL: Zachary_Roadhouse@brown.edu WEB: http://althor.netspace.org/~zack/
Brown University, Box 220, Providence, RI 02912
Phone: (401) 863 - 5435
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________