mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 21:20:18 +08:00
Attempting to add support for openni depth registration.
This commit is contained in:
parent
a87d12eb9e
commit
7d4f06b7f3
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user