Attempting to add support for openni depth registration.

This commit is contained in:
Ethan Rublee
2011-06-07 03:19:38 +00:00
parent a87d12eb9e
commit 7d4f06b7f3
2 changed files with 24 additions and 1 deletions

View File

@@ -344,7 +344,28 @@ double CvCapture_OpenNI::getDepthGeneratorProperty( int propIdx )
bool CvCapture_OpenNI::setDepthGeneratorProperty( int propIdx, double propValue )
{
CV_Assert( depthGenerator.IsValid() );
CV_Error( CV_StsBadArg, "Depth generator does not support such parameter for setting.\n");
switch(propIdx)
{
case CV_CAP_PROP_OPENNI_REGISTRATION_ON:
{
CV_Assert( imageGenerator.IsValid() );
if (!depthGenerator.GetAlternativeViewPointCap ().IsViewPointAs (imageGenerator))
{
if (depthGenerator.GetAlternativeViewPointCap ().IsViewPointSupported (imageGenerator))
{
XnStatus status = depthGenerator.GetAlternativeViewPointCap().SetViewPoint (imageGenerator);
if (status != XN_STATUS_OK)
CV_Error( CV_StsError, std::string("turning registration on failed. Reason: ") + xnGetStatusString (status));
}
else
CV_Error( CV_StsError, "turning registration on failed. Reason: unsupported viewpoint");
}
}
return true;
break;
default:
CV_Error( CV_StsBadArg, "Depth generator does not support such parameter for setting.\n");
}
return false;
}