[SciPy-user] trying to use weave to access image data in C
Prabhu Ramachandran
prabhu at aero.iitm.ernet.in
Wed Sep 29 15:32:31 EDT 2004
>>>>> "PR" == Prabhu Ramachandran <prabhu at aero.iitm.ernet.in> writes:
AD> 2. How would I step through the img variable in the C code?
AD> For example would the green value at pixel i,j be referenced
AD> as img[i][j][2] or img[i + j*rows][2] or img[(i + j*rows)*2] ?
PR> Depends on how you weave the magic. If you use
PR> converters.blitz you can simply use img(i,j,k). If you don't
PR> use the blitz converter you will only get a flattened array
PR> (i.e. a 1D array) from Numeric and will need to do pointer
PR> arithmetic appropriately to access the elements.
I've attached yet another variant that does the array access directly
using pointer arithmetic. This does not use blitz arrays and builds
faster. I've also swapped the row and cols names to be consistent
with row-major notation and storage.
cheers,
prabhu
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: t2.py
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20040930/5dac1b14/attachment.ksh>
More information about the SciPy-User
mailing list