libfreenect
0.1.2
Main Page
Classes
Files
File List
File Members
include
libfreenect.h
Go to the documentation of this file.
1
/*
2
* This file is part of the OpenKinect Project. http://www.openkinect.org
3
*
4
* Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
5
* for details.
6
*
7
* This code is licensed to you under the terms of the Apache License, version
8
* 2.0, or, at your option, the terms of the GNU General Public License,
9
* version 2.0. See the APACHE20 and GPL2 files for the text of the licenses,
10
* or the following URLs:
11
* http://www.apache.org/licenses/LICENSE-2.0
12
* http://www.gnu.org/licenses/gpl-2.0.txt
13
*
14
* If you redistribute this file in source form, modified or unmodified, you
15
* may:
16
* 1) Leave this header intact and distribute it under the same terms,
17
* accompanying it with the APACHE20 and GPL20 files, or
18
* 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or
19
* 3) Delete the GPL v2 clause and accompany it with the APACHE20 file
20
* In all cases you must keep the copyright notice intact and include a copy
21
* of the CONTRIB file.
22
*
23
* Binary distributions must follow the binary distribution requirements of
24
* either License.
25
*/
26
27
#ifndef LIBFREENECT_H
28
#define LIBFREENECT_H
29
30
#include <stdint.h>
31
32
/* We need struct timeval */
33
#ifdef _WIN32
34
#include <winsock.h>
35
#else
36
#include <sys/time.h>
37
#endif
38
39
#ifdef __cplusplus
40
extern
"C"
{
41
#endif
42
43
#define FREENECT_COUNTS_PER_G 819
45
46
#define FREENECT_DEPTH_MM_MAX_VALUE 10000
47
48
#define FREENECT_DEPTH_MM_NO_VALUE 0
49
50
#define FREENECT_DEPTH_RAW_MAX_VALUE 2048
51
52
#define FREENECT_DEPTH_RAW_NO_VALUE 2047
53
59
typedef
enum
{
60
FREENECT_DEVICE_MOTOR
= 0x01,
61
FREENECT_DEVICE_CAMERA
= 0x02,
62
FREENECT_DEVICE_AUDIO
= 0x04,
63
}
freenect_device_flags
;
64
68
struct
freenect_device_attributes
;
69
struct
freenect_device_attributes
{
70
struct
freenect_device_attributes
*
next
;
71
const
char
*
camera_serial
;
72
};
73
78
typedef
enum
{
79
FREENECT_RESOLUTION_LOW
= 0,
80
FREENECT_RESOLUTION_MEDIUM
= 1,
81
FREENECT_RESOLUTION_HIGH
= 2,
82
FREENECT_RESOLUTION_DUMMY
= 2147483647,
83
}
freenect_resolution
;
84
87
typedef
enum
{
88
FREENECT_VIDEO_RGB
= 0,
89
FREENECT_VIDEO_BAYER
= 1,
90
FREENECT_VIDEO_IR_8BIT
= 2,
91
FREENECT_VIDEO_IR_10BIT
= 3,
92
FREENECT_VIDEO_IR_10BIT_PACKED
= 4,
93
FREENECT_VIDEO_YUV_RGB
= 5,
94
FREENECT_VIDEO_YUV_RAW
= 6,
95
FREENECT_VIDEO_DUMMY
= 2147483647,
96
}
freenect_video_format
;
97
100
typedef
enum
{
101
FREENECT_DEPTH_11BIT
= 0,
102
FREENECT_DEPTH_10BIT
= 1,
103
FREENECT_DEPTH_11BIT_PACKED
= 2,
104
FREENECT_DEPTH_10BIT_PACKED
= 3,
105
FREENECT_DEPTH_REGISTERED
= 4,
106
FREENECT_DEPTH_MM
= 5,
107
FREENECT_DEPTH_DUMMY
= 2147483647,
108
}
freenect_depth_format
;
109
113
typedef
struct
{
114
uint32_t
reserved
;
115
freenect_resolution
resolution
;
116
union
{
117
int32_t
dummy
;
118
freenect_video_format
video_format
;
119
freenect_depth_format
depth_format
;
120
};
121
int32_t
bytes
;
122
int16_t
width
;
123
int16_t
height
;
124
int8_t
data_bits_per_pixel
;
125
int8_t
padding_bits_per_pixel
;
126
int8_t
framerate
;
127
int8_t
is_valid
;
128
}
freenect_frame_mode
;
129
132
typedef
enum
{
133
LED_OFF
= 0,
134
LED_GREEN
= 1,
135
LED_RED
= 2,
136
LED_YELLOW
= 3,
137
LED_BLINK_GREEN
= 4,
138
// 5 is same as 4, LED blink Green
139
LED_BLINK_RED_YELLOW
= 6,
140
}
freenect_led_options
;
141
142
144
typedef
enum
{
145
TILT_STATUS_STOPPED
= 0x00,
146
TILT_STATUS_LIMIT
= 0x01,
147
TILT_STATUS_MOVING
= 0x04,
148
}
freenect_tilt_status_code
;
149
151
typedef
struct
{
152
int16_t
accelerometer_x
;
153
int16_t
accelerometer_y
;
154
int16_t
accelerometer_z
;
155
int8_t
tilt_angle
;
156
freenect_tilt_status_code
tilt_status
;
157
}
freenect_raw_tilt_state
;
158
159
struct
_freenect_context;
160
typedef
struct
_freenect_context
freenect_context
;
162
struct
_freenect_device;
163
typedef
struct
_freenect_device
freenect_device
;
165
// usb backend specific section
166
typedef
void
freenect_usb_context
;
167
//
168
170
#ifndef _WIN32
171
#define FREENECTAPI
172
#else
173
174
#ifdef __cplusplus
175
#define FREENECTAPI extern "C" __declspec(dllexport)
176
#else
177
// this is required when building from a Win32 port of gcc without being
178
// forced to compile all of the library files (.c) with g++...
179
#define FREENECTAPI __declspec(dllexport)
180
#endif
181
#endif
182
184
typedef
enum
{
185
FREENECT_LOG_FATAL
= 0,
186
FREENECT_LOG_ERROR
,
187
FREENECT_LOG_WARNING
,
188
FREENECT_LOG_NOTICE
,
189
FREENECT_LOG_INFO
,
190
FREENECT_LOG_DEBUG
,
191
FREENECT_LOG_SPEW
,
192
FREENECT_LOG_FLOOD
,
193
}
freenect_loglevel
;
194
204
FREENECTAPI
int
freenect_init
(
freenect_context
**ctx, freenect_usb_context *usb_ctx);
205
213
FREENECTAPI
int
freenect_shutdown
(
freenect_context
*ctx);
214
216
typedef
void (*
freenect_log_cb
)(
freenect_context
*dev,
freenect_loglevel
level,
const
char
*msg);
217
224
FREENECTAPI
void
freenect_set_log_level
(
freenect_context
*ctx,
freenect_loglevel
level);
225
233
FREENECTAPI
void
freenect_set_log_callback
(
freenect_context
*ctx,
freenect_log_cb
cb);
234
242
FREENECTAPI
int
freenect_process_events
(
freenect_context
*ctx);
243
254
FREENECTAPI
int
freenect_process_events_timeout
(
freenect_context
*ctx,
struct
timeval* timeout);
255
264
FREENECTAPI
int
freenect_num_devices
(
freenect_context
*ctx);
265
275
FREENECTAPI
int
freenect_list_device_attributes
(
freenect_context
*ctx,
struct
freenect_device_attributes
** attribute_list);
276
282
FREENECTAPI
void
freenect_free_device_attributes
(
struct
freenect_device_attributes
* attribute_list);
283
292
FREENECTAPI
int
freenect_supported_subdevices
(
void
);
293
304
FREENECTAPI
void
freenect_select_subdevices
(
freenect_context
*ctx,
freenect_device_flags
subdevs);
305
317
FREENECTAPI
int
freenect_open_device
(
freenect_context
*ctx,
freenect_device
**dev,
int
index);
318
330
FREENECTAPI
int
freenect_open_device_by_camera_serial
(
freenect_context
*ctx,
freenect_device
**dev,
const
char
* camera_serial);
331
339
FREENECTAPI
int
freenect_close_device
(
freenect_device
*dev);
340
348
FREENECTAPI
void
freenect_set_user
(
freenect_device
*dev,
void
*user);
349
357
FREENECTAPI
void
*
freenect_get_user
(
freenect_device
*dev);
358
360
typedef
void (*
freenect_depth_cb
)(
freenect_device
*dev,
void
*depth, uint32_t timestamp);
362
typedef
void (*
freenect_video_cb
)(
freenect_device
*dev,
void
*video, uint32_t timestamp);
363
370
FREENECTAPI
void
freenect_set_depth_callback
(
freenect_device
*dev,
freenect_depth_cb
cb);
371
378
FREENECTAPI
void
freenect_set_video_callback
(
freenect_device
*dev,
freenect_video_cb
cb);
379
390
FREENECTAPI
int
freenect_set_depth_buffer
(
freenect_device
*dev,
void
*buf);
391
402
FREENECTAPI
int
freenect_set_video_buffer
(
freenect_device
*dev,
void
*buf);
403
411
FREENECTAPI
int
freenect_start_depth
(
freenect_device
*dev);
412
420
FREENECTAPI
int
freenect_start_video
(
freenect_device
*dev);
421
429
FREENECTAPI
int
freenect_stop_depth
(
freenect_device
*dev);
430
438
FREENECTAPI
int
freenect_stop_video
(
freenect_device
*dev);
439
449
FREENECTAPI
int
freenect_update_tilt_state
(
freenect_device
*dev);
450
458
FREENECTAPI
freenect_raw_tilt_state
*
freenect_get_tilt_state
(
freenect_device
*dev);
459
467
FREENECTAPI
double
freenect_get_tilt_degs
(
freenect_raw_tilt_state
*state);
468
481
FREENECTAPI
int
freenect_set_tilt_degs
(
freenect_device
*dev,
double
angle);
482
491
FREENECTAPI
freenect_tilt_status_code
freenect_get_tilt_status
(
freenect_raw_tilt_state
*state);
492
502
FREENECTAPI
int
freenect_set_led
(
freenect_device
*dev,
freenect_led_options
option);
503
515
FREENECTAPI
void
freenect_get_mks_accel
(
freenect_raw_tilt_state
*state,
double
* x,
double
* y,
double
* z);
516
522
FREENECTAPI
int
freenect_get_video_mode_count
();
523
532
FREENECTAPI
freenect_frame_mode
freenect_get_video_mode
(
int
mode_num);
533
542
FREENECTAPI
freenect_frame_mode
freenect_get_current_video_mode
(
freenect_device
*dev);
543
553
FREENECTAPI
freenect_frame_mode
freenect_find_video_mode
(
freenect_resolution
res,
freenect_video_format
fmt);
554
567
FREENECTAPI
int
freenect_set_video_mode
(
freenect_device
* dev,
freenect_frame_mode
mode);
568
574
FREENECTAPI
int
freenect_get_depth_mode_count
();
575
584
FREENECTAPI
freenect_frame_mode
freenect_get_depth_mode
(
int
mode_num);
585
594
FREENECTAPI
freenect_frame_mode
freenect_get_current_depth_mode
(
freenect_device
*dev);
595
605
FREENECTAPI
freenect_frame_mode
freenect_find_depth_mode
(
freenect_resolution
res,
freenect_depth_format
fmt);
606
616
FREENECTAPI
int
freenect_set_depth_mode
(
freenect_device
* dev,
const
freenect_frame_mode
mode);
617
618
#ifdef __cplusplus
619
}
620
#endif
621
622
#endif //
623
Generated on Wed Mar 19 2014 19:26:12 for libfreenect by
1.8.1.2