File: Tutorial.Basic.txt

package info (click to toggle)
openni 1.5.4.0%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 45,580 kB
  • sloc: cpp: 116,706; ansic: 58,807; sh: 10,287; cs: 7,698; java: 7,402; python: 1,547; makefile: 492; xml: 167
file content (45 lines) | stat: -rw-r--r-- 1,029 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
@page basic Basic Functions: initialize, create a node and read data

The following code illustrates the basic functionality of OpenNI. It initializes a @ref context object,
creates a single Depth node, and reads data from it.

@code
XnStatus nRetVal = XN_STATUS_OK;

xn::Context context;

// Initialize context object
nRetVal = context.Init();
// TODO: check error code

// Create a DepthGenerator node
xn::DepthGenerator depth;
nRetVal = depth.Create(context);
// TODO: check error code

// Make it start generating data
nRetVal = context.StartGeneratingAll();
// TODO: check error code

// Main loop
while (bShouldRun)
{
	// Wait for new data to be available
	nRetVal = context.WaitOneUpdateAll(depth);
	if (nRetVal != XN_STATUS_OK)
	{
		printf("Failed updating data: %s\n", xnGetStatusString(nRetVal));
		continue;
	}

	// Take current depth map
	const XnDepthPixel* pDepthMap = depth.GetDepthMap();

	// TODO: process depth map
}

// Clean-up
context.Shutdown();
@endcode
*/