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

Function main

Samples/NiSimpleCreate/NiSimpleCreate.cpp:44–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42using namespace xn;
43
44int main()
45{
46 XnStatus nRetVal = XN_STATUS_OK;
47 Context context;
48
49 nRetVal = context.Init();
50 CHECK_RC(nRetVal, "Initialize context");
51
52 DepthGenerator depth;
53 nRetVal = depth.Create(context);
54 CHECK_RC(nRetVal, "Create depth generator");
55
56 nRetVal = context.StartGeneratingAll();
57 CHECK_RC(nRetVal, "StartGeneratingAll");
58
59 DepthMetaData depthMD;
60 while (!xnOSWasKeyboardHit())
61 {
62 nRetVal = context.WaitOneUpdateAll(depth);
63 if (nRetVal != XN_STATUS_OK)
64 {
65 printf("UpdateData failed: %s\n", xnGetStatusString(nRetVal));
66 continue;
67 }
68
69 depth.GetMetaData(depthMD);
70 printf("Frame %d Middle point is: %u.\n", depthMD.FrameID(), depthMD(depthMD.XRes() / 2, depthMD.YRes() / 2));
71 }
72
73 depth.Release();
74 context.Release();
75
76 return 0;
77}

Callers

nothing calls this directly

Calls 11

xnGetStatusStringFunction · 0.85
StartGeneratingAllMethod · 0.80
WaitOneUpdateAllMethod · 0.80
FrameIDMethod · 0.80
xnOSWasKeyboardHitFunction · 0.50
InitMethod · 0.45
CreateMethod · 0.45
GetMetaDataMethod · 0.45
XResMethod · 0.45
YResMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected