void * C array to a Numpy array using Swig
- From: "Krish" <krish.subramaniam@xxxxxxxxx>
- Date: 11 Jan 2006 18:02:32 -0800
Hello People
I hope I am On Topic. Anyways, here is my problem. Any insights would
be really appreciated.
I have wrapped a C IO module using SWIG -> Python Module. Suppose the
name of the module is "imageio" and the reader function from the file
is image_read() which returns an object ( "filled" C structure) with a
lot of members.
Let
a = imageio.image_read("testfile.image")
Now a is the object which contains pointer to data of the image. ( void
* pdata). ( a also contains the datatype which I need to typecast to
get the data pointed by pdata). My question is how to access the data
pointed by pdata in *Python*.
Ideally I want the data to be converted into a Scipy(Numpy) Array
object so that I can perform further operations in Python. Any pointers
will be appreciated.
I think this has to do with PyArrayObjects, TypeMaps etc. but I
couldn't consolidate the whole information. If anyone has done this
kinda stuff before or if anyone can point me to a correct/better way,
it would be really great.
Regards
Krish Subramaniam
.
- Follow-Ups:
- Re: void * C array to a Numpy array using Swig
- From: Travis E. Oliphant
- Re: void * C array to a Numpy array using Swig
- From: Jon
- Re: void * C array to a Numpy array using Swig
- Prev by Date: Psycopg2 date problems: "Can't adapt"
- Next by Date: Re: flatten a level one list
- Previous by thread: Psycopg2 date problems: "Can't adapt"
- Next by thread: Re: void * C array to a Numpy array using Swig
- Index(es):
Relevant Pages
|