Skip to content

Commit c7eee86

Browse files
committed
Inconsistent source code
1 parent f129957 commit c7eee86

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

articles/kinect-dk/build-first-body-app.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ k4a_device_open(0, &device);
6161

6262
// Start camera. Make sure depth camera is enabled.
6363
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;
6565
deviceConfig.color_resolution = K4A_COLOR_RESOLUTION_OFF;
6666
k4a_device_start_cameras(device, &deviceConfig);
6767
```
@@ -72,7 +72,7 @@ The first step in getting body tracking results is to create a body tracker. It
7272
7373
```C
7474
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);
7676
7777
k4abt_tracker_t tracker = NULL;
7878
k4abt_tracker_create(&sensor_calibration, &tracker);
@@ -94,7 +94,7 @@ The tracker internally maintains an input queue and an output queue to asynchron
9494
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.
9595
9696
```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);
9898
k4a_capture_release(sensor_capture); // Remember to release the sensor capture once you finish using it
9999
if (queue_capture_result == K4A_WAIT_RESULT_FAILED)
100100
{
@@ -103,7 +103,7 @@ if (queue_capture_result == K4A_WAIT_RESULT_FAILED)
103103
}
104104
105105
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);
107107
if (pop_frame_result == K4A_WAIT_RESULT_SUCCEEDED)
108108
{
109109
// Successfully popped the body tracking result. Start your processing
@@ -153,11 +153,13 @@ k4a_device_close(device);
153153

154154
int main()
155155
{
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.
156160
k4a_device_configuration_t deviceConfig = K4A_DEVICE_CONFIG_INIT_DISABLE_ALL;
157161
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;
161163
VERIFY(k4a_device_start_cameras(device, &deviceConfig), "Start K4A cameras failed!");
162164

163165
k4a_calibration_t sensor_calibration;
@@ -176,7 +178,7 @@ int main()
176178
{
177179
frame_count++;
178180
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
180182
if (queue_capture_result == K4A_WAIT_RESULT_TIMEOUT)
181183
{
182184
// It should never hit timeout when K4A_WAIT_INFINITE is set.
@@ -193,10 +195,12 @@ int main()
193195
k4a_wait_result_t pop_frame_result = k4abt_tracker_pop_result(tracker, &body_frame, K4A_WAIT_INFINITE);
194196
if (pop_frame_result == K4A_WAIT_RESULT_SUCCEEDED)
195197
{
198+
// Successfully popped the body tracking result. Start your processing
199+
196200
size_t num_bodies = k4abt_frame_get_num_bodies(body_frame);
197201
printf("%zu bodies are detected!\n", num_bodies);
198202

199-
k4abt_frame_release(body_frame);
203+
k4abt_frame_release(body_frame); // Remember to release the body frame once you finish using it
200204
}
201205
else if (pop_frame_result == K4A_WAIT_RESULT_TIMEOUT)
202206
{

0 commit comments

Comments
 (0)