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

@ -360,9 +360,11 @@ enum
CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101, // in mm
CV_CAP_PROP_OPENNI_BASELINE = 102, // in mm
CV_CAP_PROP_OPENNI_FOCAL_LENGTH = 103, // in pixels
CV_CAP_PROP_OPENNI_REGISTRATION_ON = 104, // flag
CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_OUTPUT_MODE,
CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_BASELINE,
CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_FOCAL_LENGTH,
CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_REGISTRATION_ON,
// Properties of cameras available through GStreamer interface
CV_CAP_GSTREAMER_QUEUE_LENGTH = 200, // default is 1

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;
}