# undef HAVE_TBB
#endif
-#include <iostream>
#include <queue>
#ifndef i386
status = context.Init();
if( status != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed to initialize the context: "
- << cv::String(xnGetStatusString(status)) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed to initialize the context: %s\n", xnGetStatusString(status));
return;
}
status = context.EnumerateProductionTrees( XN_NODE_TYPE_DEVICE, NULL, devicesList, 0 );
if( status != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed to enumerate production trees: "
- << cv::String(xnGetStatusString(status)) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed to enumerate production trees: %s\n", xnGetStatusString(status));
return;
}
// Chose device according to index
xn::NodeInfoList::Iterator it = devicesList.Begin();
- for( int i = 0; i < index && it!=devicesList.End(); ++i ) it++;
+ for( int i = 0; i < index && it!=devicesList.End(); ++i ) it++;
if ( it == devicesList.End() )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed device with index " << index << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed device with index %d\n", index);
return;
}
status = context.CreateProductionTree( deviceNode, productionNode );
if( status != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed to create production tree: "
- << cv::String(xnGetStatusString(status)) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed to create production tree: %s\n", xnGetStatusString(status));
return;
}
status = context.RunXmlScript( XMLConfig.c_str(), scriptNode );
if( status != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed to run xml script: "
- << cv::String(xnGetStatusString(status)) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed to run xml script: %s\n", xnGetStatusString(status));
return;
}
status = context.EnumerateExistingNodes( depthList, XN_NODE_TYPE_DEPTH );
if( status != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed to enumerate depth generators: "
- << cv::String(xnGetStatusString(status)) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed to enumerate depth generators: %s\n", xnGetStatusString(status));
return;
}
if( depthList.IsEmpty() )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : The device doesn't have depth generator. Such devices aren't supported now." << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : The device doesn't have depth generator. Such devices aren't supported now.\n");
return;
}
status = depthGenerator.Create( context );
if( status != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed to create depth generator: "
- << cv::String(xnGetStatusString(status)) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed to create depth generator: %s\n", xnGetStatusString(status));
return;
}
status = context.EnumerateExistingNodes( imageList, XN_NODE_TYPE_IMAGE );
if( status != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed to enumerate image generators: "
- << cv::String(xnGetStatusString(status)) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed to enumerate image generators: %s\n", xnGetStatusString(status));
return;
}
status = imageGenerator.Create( context );
if( status != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed to create image generator: "
- << cv::String(xnGetStatusString(status)) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed to create image generator: %s\n", xnGetStatusString(status));
return;
}
}
status = context.StartGeneratingAll();
if( status != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed to start generating OpenNI data: "
- << cv::String(xnGetStatusString(status)) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed to start generating OpenNI data: %s\n", xnGetStatusString(status));
return;
}
if( !readCamerasParams() )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Could not read cameras parameters" << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Could not read cameras parameters\n");
return;
}
status = context.Init();
if( status != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed to initialize the context: "
- << cv::String(xnGetStatusString(status)) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed to initialize the context: %s\n", xnGetStatusString(status));
return;
}
status = context.OpenFileRecording( filename, productionNode );
if( status != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed to open input file (" << filename << "): "
- << cv::String(xnGetStatusString(status)) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Failed to open input file (%s): %s\n", filename, xnGetStatusString(status));
return;
}
if( !readCamerasParams() )
{
- std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Could not read cameras parameters" << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::CvCapture_OpenNI : Could not read cameras parameters\n");
return;
}
XnDouble pixelSize = 0;
if( depthGenerator.GetRealProperty( "ZPPS", pixelSize ) != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::readCamerasParams : Could not read pixel size!" << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::readCamerasParams : Could not read pixel size!\n");
return false;
}
XnUInt64 zeroPlanDistance; // in mm
if( depthGenerator.GetIntProperty( "ZPD", zeroPlanDistance ) != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::readCamerasParams : Could not read virtual plane distance!" << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::readCamerasParams : Could not read virtual plane distance!\n");
return false;
}
if( depthGenerator.GetRealProperty( "LDDIS", baseline ) != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::readCamerasParams : Could not read base line!" << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::readCamerasParams : Could not read base line!\n");
return false;
}
if( depthGenerator.GetIntProperty( "ShadowValue", shadowValue ) != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::readCamerasParams : Could not read property \"ShadowValue\"!" << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::readCamerasParams : Could not read property \"ShadowValue\"!\n");
return false;
}
if( depthGenerator.GetIntProperty("NoSampleValue", noSampleValue ) != XN_STATUS_OK )
{
- std::cerr << "CvCapture_OpenNI::readCamerasParams : Could not read property \"NoSampleValue\"!" <<std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::readCamerasParams : Could not read property \"NoSampleValue\"!\n");
return false;
}
propValue = maxTimeDuration;
break;
default :
- {
- cv::Stringstream ss;
- ss << "Such parameter (propIdx=" << propIdx << ") isn't supported for getting.\n";
- CV_Error( CV_StsBadArg, ss.str().c_str() );
- }
+ CV_Error( CV_StsBadArg, cv::format("Such parameter (propIdx=%d) isn't supported for getting.\n", propIdx) );
}
return propValue;
approxSyncGrabber->setMaxTimeDuration(maxTimeDuration);
break;
default:
- {
- cv::Stringstream ss;
- ss << "Such parameter (propIdx=" << propIdx << ") isn't supported for setting.\n";
- CV_Error( CV_StsBadArg, ss.str().c_str() );
- }
+ CV_Error( CV_StsBadArg, cv::format("Such parameter (propIdx=%d) isn't supported for setting.\n", propIdx) );
}
return isSet;
propValue = depthGenerator.GetFrameID();
break;
default :
- {
- cv::Stringstream ss;
- ss << "Depth generator does not support such parameter (propIdx=" << propIdx << ") for getting.\n";
- CV_Error( CV_StsBadArg, ss.str().c_str() );
- }
+ CV_Error( CV_StsBadArg, cv::format("Depth generator does not support such parameter (propIdx=%d) for getting.\n", propIdx) );
}
return propValue;
{
XnStatus status = depthGenerator.GetAlternativeViewPointCap().SetViewPoint(imageGenerator);
if( status != XN_STATUS_OK )
- std::cerr << "CvCapture_OpenNI::setDepthGeneratorProperty : " << xnGetStatusString(status) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::setDepthGeneratorProperty : %s\n", xnGetStatusString(status));
else
isSet = true;
}
else
- std::cerr << "CvCapture_OpenNI::setDepthGeneratorProperty : Unsupported viewpoint." << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::setDepthGeneratorProperty : Unsupported viewpoint.\n");
}
else
isSet = true;
{
XnStatus status = depthGenerator.GetAlternativeViewPointCap().ResetViewPoint();
if( status != XN_STATUS_OK )
- std::cerr << "CvCapture_OpenNI::setDepthGeneratorProperty : " << xnGetStatusString(status) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::setDepthGeneratorProperty : %s\n", xnGetStatusString(status));
else
isSet = true;
}
}
break;
default:
- {
- cv::Stringstream ss;
- ss << "Depth generator does not support such parameter (propIdx=" << propIdx << ") for setting.\n";
- CV_Error( CV_StsBadArg, ss.str().c_str() );
- }
+ CV_Error( CV_StsBadArg, cv::format("Depth generator does not support such parameter (propIdx=%d) for setting.\n", propIdx) );
}
return isSet;
propValue = imageGenerator.GetFrameID();
break;
default :
- {
- cv::Stringstream ss;
- ss << "Image generator does not support such parameter (propIdx=" << propIdx << ") for getting.\n";
- CV_Error( CV_StsBadArg, ss.str().c_str() );
- }
+ CV_Error( CV_StsBadArg, cv::format("Image generator does not support such parameter (propIdx=%d) for getting.\n", propIdx) );
}
return propValue;
XnStatus status = imageGenerator.SetMapOutputMode( mode );
if( status != XN_STATUS_OK )
- std::cerr << "CvCapture_OpenNI::setImageGeneratorProperty : " << xnGetStatusString(status) << std::endl;
+ fprintf(stderr, "CvCapture_OpenNI::setImageGeneratorProperty : %s\n", xnGetStatusString(status));
else
isSet = true;
break;
}
default:
- {
- cv::Stringstream ss;
- ss << "Image generator does not support such parameter (propIdx=" << propIdx << ") for setting.\n";
- CV_Error( CV_StsBadArg, ss.str().c_str() );
- }
+ CV_Error( CV_StsBadArg, cv::format("Image generator does not support such parameter (propIdx=%d) for setting.\n", propIdx) );
}
return isSet;