renamed property of openni camera

This commit is contained in:
Maria Dimashova 2012-03-16 09:08:18 +00:00
parent cf9a822aba
commit 00aca7e77a
4 changed files with 21 additions and 24 deletions

View File

@ -95,7 +95,7 @@ Since two types of sensor's data generators are supported (image generator and d
Some depth sensors (for example XtionPRO) do not have image generator. In order to check it you can get ``CV_CAP_OPENNI_PROP_IMAGE_GENERATOR_PRESENT`` property.
::
bool isImageGeneratorPresent = capture.get( CV_CAP_OPENNI_PROP_IMAGE_GENERATOR_PRESENT ) != 0; // or == 1
bool isImageGeneratorPresent = capture.get( CV_CAP_PROP_OPENNI_IMAGE_GENERATOR_PRESENT ) != 0; // or == 1
Flags specifing the needed generator type must be used in combination with particular generator property. The following properties of cameras available through OpenNI interfaces are supported:

View File

@ -370,15 +370,14 @@ enum
CV_CAP_PROP_GUID =29,
CV_CAP_PROP_ISO_SPEED =30,
CV_CAP_PROP_MAX_DC1394 =31,
CV_CAP_PROP_IMAGE_GENERATOR_PRESENT = 32,
CV_CAP_PROP_AUTOGRAB =1024, // property for highgui class CvCapture_Android only
CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING=1025, // readonly, tricky property, returns cpnst char* indeed
CV_CAP_PROP_PREVIEW_FORMAT=1026, // readonly, tricky property, returns cpnst char* indeed
// OpenNI map generators
CV_CAP_OPENNI_DEPTH_GENERATOR = 0,
CV_CAP_OPENNI_IMAGE_GENERATOR = 1 << 31,
CV_CAP_OPENNI_GENERATORS_MASK = 1 << 31,
CV_CAP_OPENNI_PROP_IMAGE_GENERATOR_PRESENT = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_IMAGE_GENERATOR_PRESENT,
// Properties of cameras available through OpenNI interfaces
CV_CAP_PROP_OPENNI_OUTPUT_MODE = 100,
@ -389,6 +388,7 @@ enum
CV_CAP_PROP_OPENNI_REGISTRATION = CV_CAP_PROP_OPENNI_REGISTRATION_ON, // flag that synchronizes the remapping depth map to image map
// by changing depth generator's view point (if the flag is "on") or
// sets this view point to its normal one (if the flag is "off").
CV_CAP_PROP_OPENNI_IMAGE_GENERATOR_PRESENT = 105,
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,

View File

@ -127,13 +127,13 @@ protected:
// OpenNI context
xn::Context context;
bool m_isOpened;
bool m_isImageGeneratorPresent;
// Data generators with its metadata
xn::DepthGenerator depthGenerator;
xn::DepthMetaData depthMetaData;
XnMapOutputMode depthOutputMode;
bool m_isImageGeneratorPresent;
xn::ImageGenerator imageGenerator;
xn::ImageMetaData imageMetaData;
XnMapOutputMode imageOutputMode;
@ -177,6 +177,7 @@ CvCapture_OpenNI::CvCapture_OpenNI( int index )
depthOutputMode.nFPS = imageOutputMode.nFPS = 30;
m_isOpened = false;
m_isImageGeneratorPresent = false;
// Initialize and configure the context.
if( context.Init() == XN_STATUS_OK )
@ -246,13 +247,9 @@ CvCapture_OpenNI::CvCapture_OpenNI( int index )
return;
}
if(Imagelist.IsEmpty())
if( !Imagelist.IsEmpty() )
{
m_isImageGeneratorPresent = FALSE;
}
else
{
m_isImageGeneratorPresent = TRUE;
m_isImageGeneratorPresent = true;
imageGenerator.Create( context );
if( status != XN_STATUS_OK )
{
@ -264,7 +261,7 @@ CvCapture_OpenNI::CvCapture_OpenNI( int index )
// Set map output mode.
CV_Assert( depthGenerator.SetMapOutputMode( depthOutputMode ) == XN_STATUS_OK ); // xn::DepthGenerator supports VGA only! (Jan 2011)
CV_Assert( m_isImageGeneratorPresent ? ( imageGenerator.SetMapOutputMode( imageOutputMode ) == XN_STATUS_OK ) : TRUE );
CV_Assert( m_isImageGeneratorPresent ? ( imageGenerator.SetMapOutputMode( imageOutputMode ) == XN_STATUS_OK ) : true );
// Start generating data.
status = context.StartGeneratingAll();
@ -483,7 +480,7 @@ double CvCapture_OpenNI::getImageGeneratorProperty( int propIdx )
if( !m_isImageGeneratorPresent )
return propValue;
if( propIdx == CV_CAP_PROP_IMAGE_GENERATOR_PRESENT )
if( propIdx == CV_CAP_PROP_OPENNI_IMAGE_GENERATOR_PRESENT )
propValue = m_isImageGeneratorPresent ? 1. : 0.;
else
{

View File

@ -208,7 +208,7 @@ int main( int argc, char* argv[] )
"FRAME_HEIGHT " << capture.get( CV_CAP_PROP_FRAME_HEIGHT ) << endl <<
"FRAME_MAX_DEPTH " << capture.get( CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH ) << " mm" << endl <<
"FPS " << capture.get( CV_CAP_PROP_FPS ) << endl;
if( capture.get( CV_CAP_OPENNI_PROP_IMAGE_GENERATOR_PRESENT ) )
if( capture.get( CV_CAP_PROP_OPENNI_IMAGE_GENERATOR_PRESENT ) )
{
cout <<
"\nImage generator output mode:" << endl <<