The recorder
| 437 | |
| 438 | // The recorder |
| 439 | int 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: |
nothing calls this directly
no test coverage detected