Re: How to get (void*) data into a Python array
Ronald Oussoren <[email protected]>
| Newsgroups | gmane.comp.python.pyobjc.devel |
|---|---|
| Message-ID | <[email protected]> |
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 ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb