ctypes and pointers

Diez B. Roggisch deets at nospam.web.de
Sat Apr 14 13:25:22 EDT 2007


Hi,

I'm working under mac os x with the OpenCV-library that I load via ctypes.

 From a ObjectiveC-methodcall I get an integer, that "really" is a 
pointer to an IplImage-structure.

I've got a function that takes such a pointer. But I don't find a way to 
pass it to that very function.

These are the relevant parts of my code:

         cvImage = self._f.cvImage()
         print "Address of IplImage: %x" % cvImage
         cvImage = c_void_p(cvImage)
         print cvImage
         cvImage2 = macopencv.cvCloneImage(cvImage)

The output is

2007-04-14 19:22:53.910 SequenceGrabberTest[5320] Returning IplImage at 
Address of IplImage: e860c60
e860c60
c_void_p(243666016)
2007-04-14 19:22:53.915 SequenceGrabberTest[5320] Exception raised 
during posting of notification.  Ignored.  exception: 
exceptions.ValueError: depythonifying 'pointer', got 'int'


The first line is actually from the ObjectivC-method, a log-statement.

As one can see, the pointer is passed back as integer.

But then I'm stuck.

Any suggestions would be appreciated!

diez



More information about the Python-list mailing list