本文整理汇总了C++中xn::DepthGenerator::GetIntProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ DepthGenerator::GetIntProperty方法的具体用法?C++ DepthGenerator::GetIntProperty怎么用?C++ DepthGenerator::GetIntProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xn::DepthGenerator
的用法示例。
在下文中一共展示了DepthGenerator::GetIntProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void initialize()
{
std::cout << endl << "Initializing Kinect... " << endl << endl;
g_RetVal = g_Context.Init();
g_RetVal = g_DepthGenerator.Create(g_Context);
if (g_RetVal != XN_STATUS_OK)
printf("Failed creating DEPTH generator %s\n", xnGetStatusString(g_RetVal));
XnMapOutputMode outputMode;
outputMode.nXRes = g_im_w;
outputMode.nYRes = g_im_h;
outputMode.nFPS = g_fps;
g_RetVal = g_DepthGenerator.SetMapOutputMode(outputMode);
if (g_RetVal != XN_STATUS_OK)
printf("Failed setting the DEPTH output mode %s\n", xnGetStatusString(g_RetVal));
g_RetVal = g_Context.StartGeneratingAll();
if (g_RetVal != XN_STATUS_OK)
printf("Failed starting generating all %s\n", xnGetStatusString(g_RetVal));
g_DepthGenerator.GetIntProperty ("ZPD", g_focal_length);
g_DepthGenerator.GetRealProperty ("ZPPS", g_pixel_size);
g_pixel_size *= 2.f;
g_im3D.create(g_im_h,g_im_w,CV_32FC3);
}
示例2: UpdateRWData
XnStatus XnFileDevice::UpdateRWData(const xn::DepthGenerator& depth)
{
XnStatus nRetVal = XN_STATUS_OK;
XnUInt64 nZPD;
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, nZPD);
XN_IS_STATUS_OK(nRetVal);
XnDouble fZPPS;
nRetVal = depth.GetRealProperty(XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE, fZPPS);
XN_IS_STATUS_OK(nRetVal);
XnFieldOfView FOV;
FOV.fHFOV = 2*atan(fZPPS*XN_SXGA_X_RES/2/nZPD);
FOV.fVFOV = 2*atan(fZPPS*XN_VGA_Y_RES*2/2/nZPD);
// notify
nRetVal = m_pNotifications->OnNodeGeneralPropChanged(m_pNotificationsCookie,
depth.GetName(),
XN_PROP_FIELD_OF_VIEW,
sizeof(FOV),
&FOV);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
示例3: readCamerasParams
bool CvCapture_OpenNI::readCamerasParams()
{
XnDouble pixelSize = 0;
if( depthGenerator.GetRealProperty( "ZPPS", pixelSize ) != XN_STATUS_OK )
{
std::cerr << "CvCapture_OpenNI::readCamerasParams : Could not read pixel size!" << std::endl;
return false;
}
// pixel size @ VGA = pixel size @ SXGA x 2
pixelSize *= 2.0; // in mm
// focal length of IR camera in pixels for VGA resolution
XnUInt64 zeroPlanDistance; // in mm
if( depthGenerator.GetIntProperty( "ZPD", zeroPlanDistance ) != XN_STATUS_OK )
{
std::cerr << "CvCapture_OpenNI::readCamerasParams : Could not read virtual plane distance!" << std::endl;
return false;
}
if( depthGenerator.GetRealProperty( "LDDIS", baseline ) != XN_STATUS_OK )
{
std::cerr << "CvCapture_OpenNI::readCamerasParams : Could not read base line!" << std::endl;
return false;
}
// baseline from cm -> mm
baseline *= 10;
// focal length from mm -> pixels (valid for 640x480)
depthFocalLength_VGA = (XnUInt64)((double)zeroPlanDistance / (double)pixelSize);
if( depthGenerator.GetIntProperty( "ShadowValue", shadowValue ) != XN_STATUS_OK )
{
std::cerr << "CvCapture_OpenNI::readCamerasParams : Could not read property \"ShadowValue\"!" << std::endl;
return false;
}
if( depthGenerator.GetIntProperty("NoSampleValue", noSampleValue ) != XN_STATUS_OK )
{
std::cerr << "CvCapture_OpenNI::readCamerasParams : Could not read property \"NoSampleValue\"!" <<std::endl;
return false;
}
return true;
}
示例4: XnShiftToDepthInit
XnStatus XnFileDevice::UpdateS2DTables(const xn::DepthGenerator& depth)
{
XnStatus nRetVal = XN_STATUS_OK;
XnUInt64 nTemp;
XnDouble dTemp;
// get config
XnShiftToDepthConfig config;
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE, nTemp);
XN_IS_STATUS_OK(nRetVal);
config.nZeroPlaneDistance = (XnDepthPixel)nTemp;
nRetVal = depth.GetRealProperty(XN_STREAM_PROPERTY_ZERO_PLANE_PIXEL_SIZE, dTemp);
XN_IS_STATUS_OK(nRetVal);
config.fZeroPlanePixelSize = (XnFloat)dTemp;
nRetVal = depth.GetRealProperty(XN_STREAM_PROPERTY_EMITTER_DCMOS_DISTANCE, dTemp);
XN_IS_STATUS_OK(nRetVal);
config.fEmitterDCmosDistance = (XnFloat)dTemp;
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_MAX_SHIFT, nTemp);
XN_IS_STATUS_OK(nRetVal);
config.nDeviceMaxShiftValue = (XnUInt32)nTemp;
config.nDeviceMaxDepthValue = depth.GetDeviceMaxDepth();
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_CONST_SHIFT, nTemp);
XN_IS_STATUS_OK(nRetVal);
config.nConstShift = (XnUInt32)nTemp;
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_PIXEL_SIZE_FACTOR, nTemp);
XN_IS_STATUS_OK(nRetVal);
config.nPixelSizeFactor = (XnUInt32)nTemp;
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_PARAM_COEFF, nTemp);
XN_IS_STATUS_OK(nRetVal);
config.nParamCoeff = (XnUInt32)nTemp;
nRetVal = depth.GetIntProperty(XN_STREAM_PROPERTY_SHIFT_SCALE, nTemp);
XN_IS_STATUS_OK(nRetVal);
config.nShiftScale = (XnUInt32)nTemp;
config.nDepthMinCutOff = 0;
config.nDepthMaxCutOff = (XnDepthPixel)config.nDeviceMaxDepthValue;
if (!m_ShiftToDepth.bIsInitialized)
{
nRetVal = XnShiftToDepthInit(&m_ShiftToDepth, &config);
XN_IS_STATUS_OK(nRetVal);
}
else
{
nRetVal = XnShiftToDepthUpdate(&m_ShiftToDepth, &config);
XN_IS_STATUS_OK(nRetVal);
}
// notify
nRetVal = m_pNotifications->OnNodeGeneralPropChanged(m_pNotificationsCookie, depth.GetName(), XN_STREAM_PROPERTY_S2D_TABLE, m_ShiftToDepth.nShiftsCount * sizeof(XnDepthPixel), m_ShiftToDepth.pShiftToDepthTable);
XN_IS_STATUS_OK(nRetVal);
nRetVal = m_pNotifications->OnNodeGeneralPropChanged(m_pNotificationsCookie, depth.GetName(), XN_STREAM_PROPERTY_D2S_TABLE, m_ShiftToDepth.nDepthsCount * sizeof(XnUInt16), m_ShiftToDepth.pDepthToShiftTable);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}