void convert( BP::tuple& targetTuple, XnDepthPixel const* sourceMap, XnUInt32 sourceXResolution, XnUInt32 sourceYResolution ) { BP::list proxyMapData; XnUInt32 rowIndex; XnUInt32 columnIndex; unsigned int imageIndex; XnDepthPixel currentPixelDepth; imageIndex = 0; for( rowIndex = 0; rowIndex < sourceXResolution; ++rowIndex ) { for( columnIndex = 0; columnIndex < sourceYResolution; ++columnIndex ) { currentPixelDepth = sourceMap[ imageIndex ]; proxyMapData.append( currentPixelDepth ); ++imageIndex; } // for columns } // for rows targetTuple = BP::tuple( proxyMapData ); } // convert (XnDepthPixel)
BP::list GestureGenerator_GetAvailableGestures(xn::GestureGenerator& self) { checkValid(self); XnUInt16 gestures = self.GetNumberOfAvailableGestures(); BP::list ret; if (gestures > 0) { const XnUInt16 gestureNameBufferLength = 100; // pray that this is enough space per gesture name XnChar** buf = new XnChar*[gestures]; for (XnUInt16 i = 0; i < gestures; i++) buf[i] = new XnChar[gestureNameBufferLength]; check( self.EnumerateGestures(*buf, gestures) ); for (XnUInt16 i = 0; i < gestures; i++) if (buf[i]) ret.append(std::string(buf[i])); for (XnUInt16 i = 0; i < gestures; i++) delete buf[i]; delete buf; } return ret; }
BP::list convertVec3D(XnVector3D const & vector) { BP::list ret; ret.append(vector.X); ret.append(vector.Y); ret.append(vector.Z); return ret; }
BP::list convertMatrix(XnMatrix3X3& matrix) { BP::list ret; for (int y = 0; y < 3; y++) { BP::list row; for (int x = 0; x < 3; x++) { int i = y*3 + x; row.append(matrix.elements[i]); } ret.append(row); } return ret; }
void convert( BP::tuple& targetTuple, XnRGB24Pixel const* sourceMap, XnUInt32 sourceXResolution, XnUInt32 sourceYResolution ) { BP::list proxyMapData; XnUInt32 rowIndex; XnUInt32 columnIndex; unsigned int imageIndex; XnUInt8 currentPixelRed; XnUInt8 currentPixelGreen; XnUInt8 currentPixelBlue; BP::tuple currentPixelTuple; imageIndex = 0; for( rowIndex = 0; rowIndex < sourceXResolution; ++rowIndex ) { for( columnIndex = 0; columnIndex < sourceYResolution; ++columnIndex ) { currentPixelRed = sourceMap[ imageIndex ].nRed; currentPixelGreen = sourceMap[ imageIndex ].nGreen; currentPixelBlue = sourceMap[ imageIndex ].nBlue; currentPixelTuple = BP::make_tuple( currentPixelRed, currentPixelGreen, currentPixelBlue ); proxyMapData.append( currentPixelTuple ); ++imageIndex; } // for columns } // for rows targetTuple = BP::tuple( proxyMapData ); } // convert (XnRGB24Pixel)
BP::list convertPair(XnUInt32 x, XnUInt32 y) { BP::list ret; ret.append(x); ret.append(y); return ret; }