libfreenect
0.1-beta
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
#ifdef __cplusplus
33
extern
"C"
{
34
#endif
35
36
#define FREENECT_COUNTS_PER_G 819
38
#define FREENECT_DEPTH_MM_MAX_VALUE 10000
40
#define FREENECT_DEPTH_MM_NO_VALUE 0
42
#define FREENECT_DEPTH_RAW_MAX_VALUE 2048
44
#define FREENECT_DEPTH_RAW_NO_VALUE 2047
46
52
typedef
enum
{
53
FREENECT_DEVICE_MOTOR
= 0x01,
54
FREENECT_DEVICE_CAMERA
= 0x02,
55
FREENECT_DEVICE_AUDIO
= 0x04,
56
}
freenect_device_flags
;
57
61
struct
freenect_device_attributes
;
62
struct
freenect_device_attributes
{
63
struct
freenect_device_attributes
*
next
;
64
const
char
*
camera_serial
;
65
};
66
71
typedef
enum
{
72
FREENECT_RESOLUTION_LOW
= 0,
73
FREENECT_RESOLUTION_MEDIUM
= 1,
74
FREENECT_RESOLUTION_HIGH
= 2,
75
FREENECT_RESOLUTION_DUMMY
= 2147483647,
76
}
freenect_resolution
;
77
80
typedef
enum
{
81
FREENECT_VIDEO_RGB
= 0,
82
FREENECT_VIDEO_BAYER
= 1,
83
FREENECT_VIDEO_IR_8BIT
= 2,
84
FREENECT_VIDEO_IR_10BIT
= 3,
85
FREENECT_VIDEO_IR_10BIT_PACKED
= 4,
86
FREENECT_VIDEO_YUV_RGB
= 5,
87
FREENECT_VIDEO_YUV_RAW
= 6,
88
FREENECT_VIDEO_DUMMY
= 2147483647,
89
}
freenect_video_format
;
90
93
typedef
enum
{
94
FREENECT_DEPTH_11BIT
= 0,
95
FREENECT_DEPTH_10BIT
= 1,
96
FREENECT_DEPTH_11BIT_PACKED
= 2,
97
FREENECT_DEPTH_10BIT_PACKED
= 3,
98
FREENECT_DEPTH_REGISTERED
= 4,
99
FREENECT_DEPTH_MM
= 5,
100
FREENECT_DEPTH_DUMMY
= 2147483647,
101
}
freenect_depth_format
;
102
106
typedef
struct
{
107
uint32_t
reserved
;
108
freenect_resolution
resolution
;
109
union
{
110
int32_t
dummy
;
111
freenect_video_format
video_format
;
112
freenect_depth_format
depth_format
;
113
};
114
int32_t
bytes
;
115
int16_t
width
;
116
int16_t
height
;
117
int8_t
data_bits_per_pixel
;
118
int8_t
padding_bits_per_pixel
;
119
int8_t
framerate
;
120
int8_t
is_valid
;
121
}
freenect_frame_mode
;
122
125
typedef
enum
{
126
LED_OFF
= 0,
127
LED_GREEN
= 1,
128
LED_RED
= 2,
129
LED_YELLOW
= 3,
130
LED_BLINK_GREEN
= 4,
131
// 5 is same as 4, LED blink Green
132
LED_BLINK_RED_YELLOW
= 6,
133
}
freenect_led_options
;
134
135
137
typedef
enum
{
138
TILT_STATUS_STOPPED
= 0x00,
139
TILT_STATUS_LIMIT
= 0x01,
140
TILT_STATUS_MOVING
= 0x04,
141
}
freenect_tilt_status_code
;
142
144
typedef
struct
{
145
int16_t
accelerometer_x
;
146
int16_t
accelerometer_y
;
147
int16_t
accelerometer_z
;
148
int8_t
tilt_angle
;
149
freenect_tilt_status_code
tilt_status
;
150
}
freenect_raw_tilt_state
;
151
152
struct
_freenect_context;
153
typedef
struct
_freenect_context
freenect_context
;
155
struct
_freenect_device;
156
typedef
struct
_freenect_device
freenect_device
;
158
// usb backend specific section
159
#ifdef _WIN32
160
/* frees Windows users of the burden of specifying the path to <libusb-1.0/libusb.h> */
161
typedef
void
freenect_usb_context
;
162
#else
163
#include <libusb-1.0/libusb.h>
164
typedef
libusb_context
freenect_usb_context
;
165
#endif
166
//
167
169
#ifndef _WIN32
170
#define FREENECTAPI
171
#else
172
173
#ifdef __cplusplus
174
#define FREENECTAPI extern "C" __declspec(dllexport)
175
#else
176
// this is required when building from a Win32 port of gcc without being
177
// forced to compile all of the library files (.c) with g++...
178
#define FREENECTAPI __declspec(dllexport)
179
#endif
180
#endif
181
183
typedef
enum
{
184
FREENECT_LOG_FATAL
= 0,
185
FREENECT_LOG_ERROR
,
186
FREENECT_LOG_WARNING
,
187
FREENECT_LOG_NOTICE
,
188
FREENECT_LOG_INFO
,
189
FREENECT_LOG_DEBUG
,
190
FREENECT_LOG_SPEW
,
191
FREENECT_LOG_FLOOD
,
192
}
freenect_loglevel
;
193
203
FREENECTAPI
int
freenect_init
(
freenect_context
**ctx, freenect_usb_context *usb_ctx);
204
212
FREENECTAPI
int
freenect_shutdown
(
freenect_context
*ctx);
213
215
typedef
void (*
freenect_log_cb
)(
freenect_context
*dev,
freenect_loglevel
level,
const
char
*msg);
216
223
FREENECTAPI
void
freenect_set_log_level
(
freenect_context
*ctx,
freenect_loglevel
level);
224
232
FREENECTAPI
void
freenect_set_log_callback
(
freenect_context
*ctx,
freenect_log_cb
cb);
233
241
FREENECTAPI
int
freenect_process_events
(
freenect_context
*ctx);
242
253
FREENECTAPI
int
freenect_process_events_timeout
(
freenect_context
*ctx,
struct
timeval* timeout);
254
263
FREENECTAPI
int
freenect_num_devices
(
freenect_context
*ctx);
264
274
FREENECTAPI
int
freenect_list_device_attributes
(
freenect_context
*ctx,
struct
freenect_device_attributes
** attribute_list);
275
281
FREENECTAPI
void
freenect_free_device_attributes
(
struct
freenect_device_attributes
* attribute_list);
282
291
FREENECTAPI
int
freenect_supported_subdevices
(
void
);
292
303
FREENECTAPI
void
freenect_select_subdevices
(
freenect_context
*ctx,
freenect_device_flags
subdevs);
304
316
FREENECTAPI
int
freenect_open_device
(
freenect_context
*ctx,
freenect_device
**dev,
int
index);
317
329
FREENECTAPI
int
freenect_open_device_by_camera_serial
(
freenect_context
*ctx,
freenect_device
**dev,
const
char
* camera_serial);
330
338
FREENECTAPI
int
freenect_close_device
(
freenect_device
*dev);
339
347
FREENECTAPI
void
freenect_set_user
(
freenect_device
*dev,
void
*user);
348
356
FREENECTAPI
void
*
freenect_get_user
(
freenect_device
*dev);
357
359
typedef
void (*
freenect_depth_cb
)(
freenect_device
*dev,
void
*depth, uint32_t timestamp);
361
typedef
void (*
freenect_video_cb
)(
freenect_device
*dev,
void
*video, uint32_t timestamp);
362
369
FREENECTAPI
void
freenect_set_depth_callback
(
freenect_device
*dev,
freenect_depth_cb
cb);
370
377
FREENECTAPI
void
freenect_set_video_callback
(
freenect_device
*dev,
freenect_video_cb
cb);
378
389
FREENECTAPI
int
freenect_set_depth_buffer
(
freenect_device
*dev,
void
*buf);
390
401
FREENECTAPI
int
freenect_set_video_buffer
(
freenect_device
*dev,
void
*buf);
402
410
FREENECTAPI
int
freenect_start_depth
(
freenect_device
*dev);
411
419
FREENECTAPI
int
freenect_start_video
(
freenect_device
*dev);
420
428
FREENECTAPI
int
freenect_stop_depth
(
freenect_device
*dev);
429
437
FREENECTAPI
int
freenect_stop_video
(
freenect_device
*dev);
438
448
FREENECTAPI
int
freenect_update_tilt_state
(
freenect_device
*dev);
449
457
FREENECTAPI
freenect_raw_tilt_state
*
freenect_get_tilt_state
(
freenect_device
*dev);
458
466
FREENECTAPI
double
freenect_get_tilt_degs
(
freenect_raw_tilt_state
*state);
467
480
FREENECTAPI
int
freenect_set_tilt_degs
(
freenect_device
*dev,
double
angle);
481
490
FREENECTAPI
freenect_tilt_status_code
freenect_get_tilt_status
(
freenect_raw_tilt_state
*state);
491
501
FREENECTAPI
int
freenect_set_led
(
freenect_device
*dev,
freenect_led_options
option);
502
514
FREENECTAPI
void
freenect_get_mks_accel
(
freenect_raw_tilt_state
*state,
double
* x,
double
* y,
double
* z);
515
521
FREENECTAPI
int
freenect_get_video_mode_count
();
522
531
FREENECTAPI
freenect_frame_mode
freenect_get_video_mode
(
int
mode_num);
532
541
FREENECTAPI
freenect_frame_mode
freenect_get_current_video_mode
(
freenect_device
*dev);
542
552
FREENECTAPI
freenect_frame_mode
freenect_find_video_mode
(
freenect_resolution
res,
freenect_video_format
fmt);
553
566
FREENECTAPI
int
freenect_set_video_mode
(
freenect_device
* dev,
freenect_frame_mode
mode);
567
573
FREENECTAPI
int
freenect_get_depth_mode_count
();
574
583
FREENECTAPI
freenect_frame_mode
freenect_get_depth_mode
(
int
mode_num);
584
593
FREENECTAPI
freenect_frame_mode
freenect_get_current_depth_mode
(
freenect_device
*dev);
594
604
FREENECTAPI
freenect_frame_mode
freenect_find_depth_mode
(
freenect_resolution
res,
freenect_depth_format
fmt);
605
615
FREENECTAPI
int
freenect_set_depth_mode
(
freenect_device
* dev,
const
freenect_frame_mode
mode);
616
617
#ifdef __cplusplus
618
}
619
#endif
620
621
#endif //
622
Generated on Tue Aug 6 2013 07:56:29 for libfreenect by
1.8.4