XnStatus XnShiftToDepthStreamHelper::Init() { XnStatus nRetVal = XN_STATUS_OK; // old depth streams did not have S2D tables as actual properties. Add these properties XnBool bDoesExist = FALSE; nRetVal = m_pModule->DoesPropertyExist(XN_STREAM_PROPERTY_S2D_TABLE, &bDoesExist); XN_IS_STATUS_OK(nRetVal); if (!bDoesExist) { // add properties to the module XN_VALIDATE_ADD_PROPERTIES(m_pModule, &m_ShiftToDepthTable, &m_DepthToShiftTable); m_bPropertiesAdded = TRUE; // now create tables and register to properties nRetVal = InitShiftToDepth(); XN_IS_STATUS_OK(nRetVal); } else { m_ShiftToDepthTables.pShiftToDepthTable = (XnDepthPixel*)m_ShiftToDepthTable.GetValue().pData; m_ShiftToDepthTables.pDepthToShiftTable = (XnUInt16*)m_DepthToShiftTable.GetValue().pData; } return (XN_STATUS_OK); }
XnStatus XnShiftToDepthStreamHelper::Init(XnDeviceModule* pModule) { XnStatus nRetVal = XN_STATUS_OK; XN_VALIDATE_INPUT_PTR(pModule); m_pModule = pModule; // old depth streams did not have S2D tables as actual properties. Add these properties XnBool bDoesExist = FALSE; nRetVal = m_pModule->DoesPropertyExist(XN_STREAM_PROPERTY_S2D_TABLE, &bDoesExist); XN_IS_STATUS_OK(nRetVal); if (!bDoesExist) { // add properties to the module XN_VALIDATE_ADD_PROPERTIES(m_pModule, &m_ShiftToDepthTable, &m_DepthToShiftTable); m_bPropertiesAdded = TRUE; // now create tables and register to properties XnIntProperty* pDeviceIDProperty; XnUInt64* pDeviceID = 0; pModule->GetProperty(XN_MODULE_PROPERTY_SERIAL_NUMBER, &pDeviceIDProperty); pDeviceIDProperty->GetValue(pDeviceID); xnLogVerbose("S2D", "S2D table init for sensor ID %d.", pDeviceID); nRetVal = InitShiftToDepth(); XN_IS_STATUS_OK(nRetVal); } else { m_ShiftToDepthTables.pShiftToDepthTable = (OniDepthPixel*)m_ShiftToDepthTable.GetValue().data; m_ShiftToDepthTables.pDepthToShiftTable = (XnUInt16*)m_DepthToShiftTable.GetValue().data; } return (XN_STATUS_OK); }