本文整理汇总了C++中network::init方法的典型用法代码示例。如果您正苦于以下问题:C++ network::init方法的具体用法?C++ network::init怎么用?C++ network::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类network
的用法示例。
在下文中一共展示了network::init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
//--------------------------------------------------------------------//
//------------------------- SETUP REQUIRED NODES ---------------------//
//--------------------------------------------------------------------//
// Setup the command line parameters.
setupParams(argc, argv);
// Setup all the sockets.
setupSockets();
// Setup the capture socket server for Mac.
#if (XN_PLATFORM == XN_PLATFORM_MACOSX)
if(_featureDepthMapCapture || _featureRGBCapture)
{
if(_useSockets)
{
g_AS3Network = network();
g_AS3Network.init(setupServer);
}
}
#endif
// Setup the status.
XnStatus _status = XN_STATUS_OK;
EnumerationErrors _errors;
// Context Init and Add license.
_status = _context.Init();
CHECK_RC(_status, "AS3OpenNI :: Initialize context");
_context.SetGlobalMirror(_mirror);
XnChar vendor[XN_MAX_NAME_LENGTH];
XnChar license[XN_MAX_LICENSE_LENGTH];
_license.strVendor[XN_MAX_NAME_LENGTH] = strcmp(vendor, "PrimeSense");
_license.strKey[XN_MAX_LICENSE_LENGTH] = strcmp(license, "0KOIk2JeIBYClPWVnMoRKn5cdY4=");
_status = _context.AddLicense(_license);
CHECK_RC(_status, "AS3OpenNI :: Added license");
// Set it to VGA maps at 30 FPS
_depthMode.nXRes = 640;
_depthMode.nYRes = 480;
_depthMode.nFPS = 30;
// Depth map create.
_status = _depth.Create(_context);
CHECK_RC(_status, "AS3OpenNI :: Create depth generator");
_status = _depth.SetMapOutputMode(_depthMode);
// Depth map create.
_status = _image.Create(_context);
CHECK_RC(_status, "AS3OpenNI :: Create image generator");
_status = _image.SetMapOutputMode(_depthMode);
_status = _image.SetPixelFormat(XN_PIXEL_FORMAT_RGB24);
// Create the hands generator.
_status = _hands.Create(_context);
CHECK_RC(_status, "AS3OpenNI :: Create hands generator");
_hands.SetSmoothing(0.1);
// Create the gesture generator.
_status = _gesture.Create(_context);
CHECK_RC(_status, "AS3OpenNI :: Create gesture generator");
// Create user generator.
_status = _userGenerator.Create(_context);
CHECK_RC(_status, "AS3OpenNI :: Find user generator");
// Create and initialize point tracker
_sessionManager = new XnVSessionManager();
_status = _sessionManager->Initialize(&_context, "Wave", "RaiseHand");
if (_status != XN_STATUS_OK)
{
printf("AS3OpenNI :: Couldn't initialize the Session Manager: %s\n", xnGetStatusString(_status));
CleanupExit();
}
_sessionManager->RegisterSession(NULL, &SessionStart, &SessionEnd, &SessionProgress);
// Start catching signals for quit indications
CatchSignals(&_quit);
//---------------------------------------------------------------//
//------------------------- SETUP FEATURES ---------------------//
//--------------------------------------------------------------//
// Define the Wave and SinglePoint detectors.
_waveDetector = new XnVWaveDetector();
// SinglePoint detector.
if(_featureSinglePoint) _waveDetector->RegisterPointUpdate(NULL, &OnPointUpdate);
// Feature Gesture.
if(_featureGesture)
{
// Wave detector.
_waveDetector->RegisterWave(NULL, &OnWave);
//.........这里部分代码省略.........