Re: [Pyobjc-dev] How to get (void*) data into a Python array
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2011-02-08 13:39:09
|
On 4 Feb, 2011, at 21:55, Trevor Bentley wrote: >> IMHO your problem is not PyObjc - you have everything you need there. It's getting things into NumPy. >> >> One way would be to use ctypes. You can create a pointer to whatever data-type you want, and initialize that with the returned integer. I don't have example code right here (wrong machine), but it's not that hard. >> >> then at least you can access the data properly, and stuff it into a NumPy array. >> >> However, the best solution would of course be to be able to create a NumPy array based on the pointer. I know NumPy has a C-API, maybe that's exposed somehow? >> >> Diez > > That's where I took it immediately after sending the e-mail: ctypes > pointers. I managed to get a pointer to something... maybe it's pixel > data. NumPy doesn't want to import my pointer as an array, and it turns > out I don't know what format the returned data is in, anyway. > > Since efficiency isn't even a slight concern, I actually found a > technique that works... Which techinque did you find? Ronald |