MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / main

Function main

Samples/NiBackRecorder/main.cpp:439–558  ·  view source on GitHub ↗

The recorder

Source from the content-addressed store, hash-verified

437
438// The recorder
439int main(int argc, char** argv)
440{
441 // OpenNi objects
442 xn::Context context;
443 xn::DepthGenerator depthGenerator;
444 xn::ImageGenerator imageGenerator;
445
446 // To count missed frames
447 XnUInt64 nLastDepthTime = 0;
448 XnUInt64 nLastImageTime = 0;
449 XnUInt32 nMissedDepthFrames = 0;
450 XnUInt32 nMissedImageFrames = 0;
451 XnUInt32 nDepthFrames = 0;
452 XnUInt32 nImageFrames = 0;
453
454 RecConfiguration config;
455
456 XnStatus nRetVal = XN_STATUS_OK;
457
458 // Parse the command line arguments
459 if (!ParseArgs(argc, argv, config))
460 {
461 printf("Parse error\n");
462 return 1;
463 }
464
465 if (config.bVerbose)
466 {
467 // Turn on log
468 xnLogInitSystem();
469 xnLogSetConsoleOutput(TRUE);
470 xnLogSetMaskMinSeverity(XN_LOG_MASK_ALL, XN_LOG_VERBOSE);
471 }
472
473 // Initialize OpenNI
474 nRetVal = context.Init();
475 CHECK_RC(nRetVal, "Init");
476
477 nRetVal = ConfigureGenerators(config, context, depthGenerator, imageGenerator);
478 CHECK_RC(nRetVal, "Config generators");
479
480 nRetVal = context.StartGeneratingAll();
481 CHECK_RC(nRetVal, "Generate all");
482
483 // Create and initialize the cyclic buffer
484 CyclicBuffer cyclicBuffer(context, depthGenerator, imageGenerator, config);
485 cyclicBuffer.Initialize(config.strDirName, config.nDumpTime);
486
487 // Mainloop
488 for (;;)
489 {
490 if (xnOSWasKeyboardHit())
491 {
492 char c = xnOSReadCharFromInput();
493 XnBool bStop = FALSE;
494 switch (c)
495 {
496 case 27:

Callers

nothing calls this directly

Calls 15

ParseArgsFunction · 0.85
xnLogInitSystemFunction · 0.85
xnLogSetConsoleOutputFunction · 0.85
xnLogSetMaskMinSeverityFunction · 0.85
ConfigureGeneratorsFunction · 0.85
StartGeneratingAllMethod · 0.80
DumpMethod · 0.80
WaitAndUpdateAllMethod · 0.80
UpdateMethod · 0.80
xnOSWasKeyboardHitFunction · 0.50
xnOSReadCharFromInputFunction · 0.50
InitMethod · 0.45

Tested by

no test coverage detected