File: Tutorial.ConfigureNodes.txt

package info (click to toggle)
openni 1.5.4.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 44,844 kB
  • sloc: cpp: 116,706; ansic: 58,777; sh: 10,287; cs: 7,698; java: 7,402; python: 1,541; makefile: 492; xml: 167
file content (44 lines) | stat: -rw-r--r-- 1,283 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
/**
@page tut_config Configuring nodes

An application would usually want to fully configure a node before it starts streaming data. For that reason,
OpenNI defines a flow in which configuration can take place, and once all configuration is set, the node
@ref xn::Generator::StartGenerating() method can be called to make it start streaming the data.

The following code creates a depth generator, configures it to VGA resolution, 30 FPS, and then starts it:
@code
// Create a DepthGenerator node
xn::DepthGenerator depth;
nRetVal = depth.Create(context);
// TODO: check error code

XnMapOutputMode outputMode;
outputMode.nXRes = 640;
outputMode.nYRes = 480;
outputMode.nFPS = 30;
nRetVal = depth.SetMapOutputMode(outputMode);
// TODO: check error code

// We're done configuring it. 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
}
@endcode

*/