本文整理汇总了C++中XnProperty::OnChangeEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ XnProperty::OnChangeEvent方法的具体用法?C++ XnProperty::OnChangeEvent怎么用?C++ XnProperty::OnChangeEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XnProperty
的用法示例。
在下文中一共展示了XnProperty::OnChangeEvent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitShiftToDepth
XnStatus XnShiftToDepthStreamHelper::InitShiftToDepth()
{
XnStatus nRetVal = XN_STATUS_OK;
// register to any shift-to-depth property (so tables can be updated if needed)
const XnChar* propNames[] =
{
XN_STREAM_PROPERTY_MIN_DEPTH,
XN_STREAM_PROPERTY_MAX_DEPTH,
XN_STREAM_PROPERTY_CONST_SHIFT,
XN_STREAM_PROPERTY_PIXEL_SIZE_FACTOR,
XN_STREAM_PROPERTY_PARAM_COEFF,
XN_STREAM_PROPERTY_SHIFT_SCALE,
XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE,
XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE,
XN_STREAM_PROPERTY_EMITTER_DCMOS_DISTANCE
};
XnUInt32 nPropCount = sizeof(propNames) / sizeof(const XnChar*);
XnCallbackHandle hDummy;
XnProperty* pProperty = NULL;
for (XnUInt32 i = 0; i < nPropCount; ++i)
{
nRetVal = m_pModule->GetProperty(propNames[i], &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(ShiftToDepthPropertyValueChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
}
// register for tables size properties
nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_MAX_SHIFT, &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_DEVICE_MAX_DEPTH, &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
// now init the tables
XnShiftToDepthConfig Config;
nRetVal = GetShiftToDepthConfig(Config);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnShiftToDepthInit(&m_ShiftToDepthTables, &Config);
XN_IS_STATUS_OK(nRetVal);
// replace tables buffers
m_ShiftToDepthTable.ReplaceBuffer(m_ShiftToDepthTables.pShiftToDepthTable, m_ShiftToDepthTables.nShiftsCount * sizeof(XnDepthPixel));
m_DepthToShiftTable.ReplaceBuffer(m_ShiftToDepthTables.pDepthToShiftTable, m_ShiftToDepthTables.nDepthsCount * sizeof(XnUInt16));
return (XN_STATUS_OK);
}
示例2: RegisterToProps
XnStatus XnServerSensorInvoker::RegisterToProps(XnPropertySet* pProps)
{
XnStatus nRetVal = XN_STATUS_OK;
XnCallbackHandle hDummy = NULL;
for (XnPropertySetData::Iterator itMod = pProps->pData->Begin(); itMod != pProps->pData->End(); ++itMod)
{
XnActualPropertiesHash* pHash = itMod->Value();
XnDeviceModule* pModule;
nRetVal = m_sensor.FindModule(itMod->Key(), &pModule);
XN_IS_STATUS_OK(nRetVal);
for (XnActualPropertiesHash::Iterator itProp = pHash->Begin(); itProp != pHash->End(); ++itProp)
{
XnProperty* pProp;
nRetVal = pModule->GetProperty(itProp->Key(), &pProp);
XN_IS_STATUS_OK(nRetVal);
// no need to keep the handle. We only want to unregister when the stream is destroyed, and then
// it happens anyway.
nRetVal = pProp->OnChangeEvent().Register(PropertyChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
}
}
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:28,代码来源:XnServerSensorInvoker.cpp
示例3: UnregisterFromOnPropertyValueChanged
XnStatus XnDeviceModule::UnregisterFromOnPropertyValueChanged(const XnChar* strName, XnCallbackHandle hCallback)
{
XnStatus nRetVal = XN_STATUS_OK;
XnProperty* pProp;
nRetVal = GetProperty(strName, &pProp);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProp->OnChangeEvent().Unregister(hCallback);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
示例4: RegisterForOnPropertyValueChanged
XnStatus XnDeviceModule::RegisterForOnPropertyValueChanged(const XnChar* strName, XnProperty::OnValueChangedHandler pFunc, void* pCookie, XnCallbackHandle& hCallback)
{
XnStatus nRetVal = XN_STATUS_OK;
XnProperty* pProp;
nRetVal = GetProperty(strName, &pProp);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProp->OnChangeEvent().Register(pFunc, pCookie, hCallback);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
示例5: InitShiftToDepth
XnStatus XnShiftToDepthStreamHelper::InitShiftToDepth()
{
XnStatus nRetVal = XN_STATUS_OK;
xnLogVerbose("S2D", "test1");
// register to any shift-to-depth property (so tables can be updated if needed)
XnUInt32 propIds[] =
{
XN_STREAM_PROPERTY_MIN_DEPTH,
XN_STREAM_PROPERTY_MAX_DEPTH,
XN_STREAM_PROPERTY_CONST_SHIFT,
XN_STREAM_PROPERTY_PIXEL_SIZE_FACTOR,
XN_STREAM_PROPERTY_PARAM_COEFF,
XN_STREAM_PROPERTY_SHIFT_SCALE,
XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE,
XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE,
XN_STREAM_PROPERTY_EMITTER_DCMOS_DISTANCE,
XN_STREAM_PROPERTY_OUTPUT_FORMAT,
XN_STREAM_PROPERTY_CUSTOM_S2D_TABLE_ID
};
xnLogVerbose("S2D", "test2");
XnUInt32 nPropCount = sizeof(propIds) / sizeof(propIds[0]);
xnLogVerbose("S2D", "test3");
XnCallbackHandle hDummy;
XnProperty* pProperty = NULL;
for (XnUInt32 i = 0; i < nPropCount; ++i)
{
xnLogVerbose("S2D", "test4");
nRetVal = m_pModule->GetProperty(propIds[i], &pProperty);
xnLogVerbose("S2D", "test5 %s", xnGetStatusString(nRetVal));
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(ShiftToDepthPropertyValueChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
xnLogVerbose("S2D", "test6");
}
// XnUInt64 CustomTableID = ((XnActualIntProperty*)pProperty)->GetValue();
// xnLogVerbose("S2D", "S2D custom table ID: %d", CustomTableID);
// register for tables size properties
nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_MAX_SHIFT, &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_DEVICE_MAX_DEPTH, &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_OUTPUT_FORMAT, &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
// now init the tables
XnShiftToDepthConfig Config;
nRetVal = GetShiftToDepthConfig(Config);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnShiftToDepthInit(&m_ShiftToDepthTables, &Config);
XN_IS_STATUS_OK(nRetVal);
// replace tables buffers
m_ShiftToDepthTable.ReplaceBuffer(m_ShiftToDepthTables.pShiftToDepthTable, m_ShiftToDepthTables.nShiftsCount * sizeof(OniDepthPixel));
m_DepthToShiftTable.ReplaceBuffer(m_ShiftToDepthTables.pDepthToShiftTable, m_ShiftToDepthTables.nDepthsCount * sizeof(XnUInt16));
return (XN_STATUS_OK);
}
示例6: ChooseCodec
//.........这里部分代码省略.........
switch (nOutputFormat)
{
case XN_OUTPUT_FORMAT_GRAYSCALE8:
bRGB = FALSE;
break;
case XN_OUTPUT_FORMAT_RGB24:
bRGB = TRUE;
break;
default:
XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Codec factory currently supports JPEG codec only for streams of type Gray8 or RGB24!");
}
nRetVal = CodecProps.AddLast(pOutputFormatProp);
XN_IS_STATUS_OK(nRetVal);
// X res
XnIntProperty* pXResProp;
nRetVal = GetStream()->GetProperty(XN_STREAM_PROPERTY_X_RES, &pXResProp);
XN_IS_STATUS_OK(nRetVal);
XnUInt64 nXRes;
nRetVal = pXResProp->GetValue(&nXRes);
XN_IS_STATUS_OK(nRetVal);
nRetVal = CodecProps.AddLast(pXResProp);
XN_IS_STATUS_OK(nRetVal);
// Y res
XnIntProperty* pYResProp;
nRetVal = GetStream()->GetProperty(XN_STREAM_PROPERTY_Y_RES, &pYResProp);
XN_IS_STATUS_OK(nRetVal);
XnUInt64 nYRes;
nRetVal = pYResProp->GetValue(&nYRes);
XN_IS_STATUS_OK(nRetVal);
// Cropping
XnGeneralProperty* pCroppingProp;
nRetVal = GetStream()->GetProperty(XN_STREAM_PROPERTY_CROPPING, &pCroppingProp);
XN_IS_STATUS_OK(nRetVal);
XnCropping cropping;
nRetVal = pCroppingProp->GetValue(XN_PACK_GENERAL_BUFFER(cropping));
XN_IS_STATUS_OK(nRetVal);
nRetVal = CodecProps.AddLast(pCroppingProp);
XN_IS_STATUS_OK(nRetVal);
// calc x,y
if (cropping.bEnabled)
{
nXRes = cropping.nXSize;
nYRes = cropping.nYSize;
}
XN_VALIDATE_NEW_AND_INIT(pCodec, XnJpegCodec, bRGB, (XnUInt32)nXRes, (XnUInt32)nYRes);
}
break;
default:
XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Codec factory does not support compression type %d", GetCompression());
}
// register to new props
for (XnPropertiesList::Iterator it = CodecProps.Begin(); it != CodecProps.End(); ++it)
{
XnProperty* pProp = *it;
XnPropertiesHash::Iterator hashIt = m_CodecProperties.End();
nRetVal = m_CodecProperties.Find(pProp, hashIt);
if (nRetVal == XN_STATUS_NO_MATCH)
{
XnCallbackHandle hCallbackDummy;
nRetVal = pProp->OnChangeEvent().Register(CodecPropertyChangedCallback, this, hCallbackDummy);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(pCodec);
return (nRetVal);
}
nRetVal = m_CodecProperties.Set(pProp, NULL);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(pCodec);
return (nRetVal);
}
}
else if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(pCodec);
return (nRetVal);
}
}
// replace it
XN_DELETE(m_pCodec);
m_pCodec = pCodec;
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:101,代码来源:XnStreamDeviceStreamHolder.cpp