@@ -61,7 +61,7 @@ k4a_device_open(0, &device);
61
61
62
62
// Start camera. Make sure depth camera is enabled.
63
63
k4a_device_configuration_t deviceConfig = K4A_DEVICE_CONFIG_INIT_DISABLE_ALL;
64
- deviceConfig.depth_mode = K4A_DEPTH_MODE_WFOV_2X2BINNED ;
64
+ deviceConfig.depth_mode = K4A_DEPTH_MODE_NFOV_UNBINNED ;
65
65
deviceConfig.color_resolution = K4A_COLOR_RESOLUTION_OFF;
66
66
k4a_device_start_cameras(device, &deviceConfig);
67
67
```
@@ -72,7 +72,7 @@ The first step in getting body tracking results is to create a body tracker. It
72
72
73
73
```C
74
74
k4a_calibration_t sensor_calibration;
75
- k4a_device_get_calibration(device, deviceConfig.depth_mode, K4A_COLOR_RESOLUTION_OFF , &sensor_calibration);
75
+ k4a_device_get_calibration(device, deviceConfig.depth_mode, deviceConfig.color_resolution , &sensor_calibration);
76
76
77
77
k4abt_tracker_t tracker = NULL;
78
78
k4abt_tracker_create(&sensor_calibration, &tracker);
@@ -94,7 +94,7 @@ The tracker internally maintains an input queue and an output queue to asynchron
94
94
Your first body tracking application uses the real-time processing pattern. Refer to [get body tracking results](get-body-tracking-results.md) for a detailed explanation of the other patterns.
95
95
96
96
```C
97
- k4a_wait_result_t queue_capture_result = k4abt_tracker_enqueue_capture(tracker, sensor_capture, 0 );
97
+ k4a_wait_result_t queue_capture_result = k4abt_tracker_enqueue_capture(tracker, sensor_capture, K4A_WAIT_INFINITE );
98
98
k4a_capture_release(sensor_capture); // Remember to release the sensor capture once you finish using it
99
99
if (queue_capture_result == K4A_WAIT_RESULT_FAILED)
100
100
{
@@ -103,7 +103,7 @@ if (queue_capture_result == K4A_WAIT_RESULT_FAILED)
103
103
}
104
104
105
105
k4abt_frame_t body_frame = NULL;
106
- k4a_wait_result_t pop_frame_result = k4abt_tracker_pop_result(tracker, &body_frame, 0 );
106
+ k4a_wait_result_t pop_frame_result = k4abt_tracker_pop_result(tracker, &body_frame, K4A_WAIT_INFINITE );
107
107
if (pop_frame_result == K4A_WAIT_RESULT_SUCCEEDED)
108
108
{
109
109
// Successfully popped the body tracking result. Start your processing
@@ -153,11 +153,13 @@ k4a_device_close(device);
153
153
154
154
int main()
155
155
{
156
+ k4a_device_t device = NULL;
157
+ VERIFY (k4a_device_open (0, &device), "Open K4A Device failed!");
158
+
159
+ // Start camera. Make sure depth camera is enabled.
156
160
k4a_device_configuration_t deviceConfig = K4A_DEVICE_CONFIG_INIT_DISABLE_ALL;
157
161
deviceConfig.depth_mode = K4A_DEPTH_MODE_NFOV_UNBINNED;
158
-
159
- k4a_device_t device;
160
- VERIFY (k4a_device_open (0, &device), "Open K4A Device failed!");
162
+ deviceConfig.color_resolution = K4A_COLOR_RESOLUTION_OFF;
161
163
VERIFY (k4a_device_start_cameras (device, &deviceConfig), "Start K4A cameras failed!");
162
164
163
165
k4a_calibration_t sensor_calibration;
@@ -176,7 +178,7 @@ int main()
176
178
{
177
179
frame_count++;
178
180
k4a_wait_result_t queue_capture_result = k4abt_tracker_enqueue_capture(tracker, sensor_capture, K4A_WAIT_INFINITE);
179
- k4a_capture_release (sensor_capture);
181
+ k4a_capture_release (sensor_capture); // Remember to release the sensor capture once you finish using it
180
182
if (queue_capture_result == K4A_WAIT_RESULT_TIMEOUT)
181
183
{
182
184
// It should never hit timeout when K4A_WAIT_INFINITE is set.
@@ -193,10 +195,12 @@ int main()
193
195
k4a_wait_result_t pop_frame_result = k4abt_tracker_pop_result(tracker, &body_frame, K4A_WAIT_INFINITE);
194
196
if (pop_frame_result == K4A_WAIT_RESULT_SUCCEEDED)
195
197
{
198
+ // Successfully popped the body tracking result. Start your processing
199
+
196
200
size_t num_bodies = k4abt_frame_get_num_bodies(body_frame);
197
201
printf ("%zu bodies are detected!\n", num_bodies);
198
202
199
- k4abt_frame_release (body_frame);
203
+ k4abt_frame_release (body_frame); // Remember to release the body frame once you finish using it
200
204
}
201
205
else if (pop_frame_result == K4A_WAIT_RESULT_TIMEOUT)
202
206
{
0 commit comments