Kinect / PyKinect2

Wrapper to expose Kinect for Windows v2 API in Python
MIT License
498 stars 237 forks source link

CoordinateMapper : wrong profile for MapDepthFrameToColorSpace #22

Open pgrassia-opri opened 9 years ago

pgrassia-opri commented 9 years ago

Using the following snippet, where mapper is a coordinatermapper object result in a "python has stopped working" error message

CSP_Count=kinect._depth_frame_data_capacity 
CSP_type= _ColorSpacePoint * CSP_Count.value
CSP=ctypes.cast(CSP_type(), ctypes.POINTER(_ColorSpacePoint))
mapper.MapDepthFrameToColorSpace(kinect._depth_frame_data_capacity,kinect._depth_frame_data, CSP_Count, CSP)

that snippet is conform to the profile of the function defined in PyKinectV2.py which in turn is conform to the documentation

I got the function to perform properly by changing the profile of the method to use an array of c_float instead of _ColorSpacePoint (PyKinectV2.py line 2114) and changing the cast accordingingly.

I'm using Python 2.7.9 32 bit (one of the libs I use does not perform well in 64 bit) and the latest kinect v2 sdk (1409)

(edit: corrected a markdown typo)

abhirajD commented 8 years ago

@pgrassia-opri how did you access the c_float array through pyKinectRuntime?

sarabsethi commented 6 years ago

@pgrassia-opri sorry, I'm quite unfamiliar with ctypes - how do you retrieve the mapped data after running the above code? Thanks

Franzisdrak commented 6 years ago

@pgrassia-opri Did you write the CoordinateMapper in Python? Or do you have any suggestions how i could do it myself? I want to overlay the IR/Depth with the bigger rgb image, but i am having problems doing the lens corrections/mapping myself.