XnStatus XnRegistration::BuildRegTable1000() { XnStatus nRetVal = XN_STATUS_OK; // take needed parameters to perform registration XnRegistrationInformation1000 regInfo1000; nRetVal = XnHostProtocolAlgorithmParams(m_pDevicePrivateData, XN_HOST_PROTOCOL_ALGORITHM_REGISTRATION, ®Info1000, sizeof(regInfo1000), m_pDepthStream->GetResolution(), (XnUInt16)m_pDepthStream->GetFPS()); XN_IS_STATUS_OK(nRetVal); XnUInt16* pRegTable = m_pRegistrationTable; XnDouble dDeltaX, dDeltaY; XnDouble dNewX = 0, dNewY = 0; XnUInt32 nDepthXRes = m_pDepthStream->GetXRes(); XnUInt32 nDepthYRes = m_pDepthStream->GetYRes(); const XnUInt16 nIllegalValue = XnUInt16(nDepthXRes*4); for (XnUInt16 nY = 0; nY < nDepthYRes; nY++) { for (XnUInt16 nX = 0; nX < nDepthXRes; nX++) { dDeltaX = XnXRegistrationFunction1000(regInfo1000, nX, nY, nDepthXRes, nDepthYRes); dDeltaY = XnYRegistrationFunction1000(regInfo1000, nX, nY, nDepthXRes, nDepthYRes); dNewX = (nX + dDeltaX); dNewY = nY + dDeltaY; if (dNewY < 1 || dNewY > nDepthYRes) { dNewY = 1; dNewX = nIllegalValue; } if (dNewX < 1 || dNewX > nDepthXRes) { dNewX = nIllegalValue; } dNewX *= XN_REG_X_SCALE; *pRegTable = (XnUInt16)dNewX; *(pRegTable + 1) = (XnUInt16)dNewY; pRegTable += 2; } } m_dShiftFactor = regInfo1000.dBeta; return (XN_STATUS_OK); }
XnStatus XnSensor::SetCmosBlankingTime(const XnCmosBlankingTime* pBlanking) { XnStatus nRetVal = XN_STATUS_OK; // check version if (m_Firmware.GetInfo()->nFWVer < XN_SENSOR_FW_VER_5_1) { return (XN_STATUS_IO_DEVICE_FUNCTION_NOT_SUPPORTED); } // get coefficients const XnCmosBlankingCoefficients* pCoeffs = m_CmosInfo.GetBlankingCoefficients(pBlanking->nCmosID); // translate to units request XnCmosBlankingUnits blankingUnits; blankingUnits.nCmosID = pBlanking->nCmosID; blankingUnits.nNumberOfFrames = pBlanking->nNumberOfFrames; blankingUnits.nUnits = XnUInt16((pBlanking->nTimeInMilliseconds*1000 - pCoeffs->fB)/pCoeffs->fA); nRetVal = SetCmosBlankingUnits(&blankingUnits); XN_IS_STATUS_OK(nRetVal); return (XN_STATUS_OK); }