Skip to content

Commit 88ec641

Browse files
committed
Merge commit 'v0.2.0-1-g5eed1f0' into dfsg
* commit 'v0.2.0-1-g5eed1f0': (35 commits) Update CMake version for v0.2.0 Kinect for Windows and Xbox 360 Model 1473 support Changed all GL-related INCLUDE_DIRS to INCLUDE_DIR Fixes OpenKinect#320 as3-bom: Support uncompressed depth camera-flags: added depth and video mirror camera-flags: initial commit Fixed fprintf format warnings Removed Formula now in homebrew Library Added Kinect for Windows udev rules Removed unused stdbool.h Replaced all include guards with '#pragma once' - fixes OpenKinect#296 Removed libusb patch already merged upstream handle error case on USB 3.0: control transfer may return 512 bytes FrameMode now implements getFieldOrder() to be compatible with new versions of jna. Signed-off-by: John Scheible johnscheible@gmail.com Adding to C++ wrapper a method to access the underlying freenect_device Signed-off-by: Joseph J Dillon <joe.robotics@hotmail.com> josephd Added missing dependencies examples: GLUT_INCLUDE_DIRS -> GLUT_INCLUDE_DIR wavrecord.c: initialize sample count to 0 audio firmware loader: use the structure of the firmware image format to specify size/addresses freenect.pyx: add FREENECT_DEPTH_{MM,REGISTERED} support windows: libusb-win32 renamed their header; change the include accordingly ...
2 parents 509bf56 + 5eed1f0 commit 88ec641

51 files changed

Lines changed: 704 additions & 412 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ cmake_minimum_required(VERSION 2.6)
4141
PROJECT(libfreenect)
4242

4343
set (PROJECT_VER_MAJOR 0)
44-
set (PROJECT_VER_MINOR 1)
45-
set (PROJECT_VER_PATCH 2)
44+
set (PROJECT_VER_MINOR 2)
45+
set (PROJECT_VER_PATCH 0)
4646
set (PROJECT_VER
4747
"${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}.${PROJECT_VER_PATCH}")
4848
set (PROJECT_APIVER
@@ -86,6 +86,12 @@ if(BUILD_AUDIO)
8686
add_definitions(-DBUILD_AUDIO)
8787
endif()
8888

89+
if (WIN32)
90+
set(MATH_LIB "")
91+
else(WIN32)
92+
set(MATH_LIB "m")
93+
endif()
94+
8995
######################################################################################
9096
# CMake
9197
######################################################################################
@@ -112,7 +118,7 @@ include_directories(${LIBUSB_1_INCLUDE_DIRS})
112118

113119
if(WIN32)
114120
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/platform/windows")
115-
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/platform/windows/libusb10emu")
121+
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/platform/windows/libusb10emu/libusb-1.0")
116122
endif()
117123

118124
# Add library project

README.asciidoc

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ http://twitter.com/openkinect
4343

4444
For the driver, you'll need
4545

46-
- libusb-1.0 >= 1.0.3 (*nix and OS X)
46+
- libusb-1.0 >= 1.0.9 (*nix and OS X)
4747
- libusb-win32 (Windows)
4848
- Cmake >= 2.6 (All platforms)
4949

@@ -73,33 +73,9 @@ To use CMake:
7373

7474
==== OS X
7575

76-
NOTE: AS OF 2010-11-16, WE HAVE UPDATED THIS PATCH. IF YOU HAVE
77-
ALREADY PATCHED, PLEASE REPATCH AND REINSTALL LIBUSB TO GET OS X
78-
WORKING AT FULL 30FPS.
79-
80-
You will need to pull the matching version of libusb for this
81-
patch. This is NOT v1.0.8, this is a change based off the repo head as
82-
of 2010-10-16. To get a tar.gz with the snapshot of the repo at this
83-
point, hit the link below.
84-
85-
http://git.libusb.org/?p=libusb.git;a=snapshot;h=7da756e09fd97efad2b35b5cee0e2b2550aac2cb;sf=tgz;js=1
86-
87-
Once you've gotten that tarball and unziped it somewhere, patch using
88-
the files in platform/osx/. Just go to the root directory of the
89-
libusb source and run
90-
91-
patch -p1 < [path_to_OpenKinectRepo]/platform/osx/libusb-osx-kinect.diff
92-
93-
You need to tell configure to include some necessary frameworks:
94-
./configure LDFLAGS='-framework IOKit -framework CoreFoundation'
95-
96-
Recompile libusb and put it wherever CMake will look (/usr/local/lib,
97-
/usr/lib, etc...). If you're using a package manager like fink,
98-
macports, or homebrew, I'm going to expect you know what your doing
99-
and can deal with this. If not, see IRC channel.
100-
101-
OpenGL and GLUT come as prebuilt frameworks with OS X, so that should
102-
do it for requirements.
76+
libusb is available through various package managers
77+
including homebrew and Macports.
78+
OpenGL and GLUT come as prebuilt frameworks.
10379

10480
==== Linux
10581

@@ -128,9 +104,10 @@ libfreenect has interface to several languages. Look in the wrappers/
128104
directory for them:
129105

130106
- C (using a synchronous API)
107+
- C++
108+
- C#
131109
- python
132110
- actionscript
133-
- C#
134111
- Java (JNA)
135112

136113
=== Licensing

cmake_modules/Findlibusb-1.0.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
4949
else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
5050
find_path(LIBUSB_1_INCLUDE_DIR
5151
NAMES
52-
libusb-1.0/libusb.h
52+
libusb.h
5353
PATHS
5454
/usr/include
5555
/usr/local/include
@@ -61,7 +61,7 @@ else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
6161

6262
find_library(LIBUSB_1_LIBRARY
6363
NAMES
64-
usb-1.0
64+
usb-1.0 usb
6565
PATHS
6666
/usr/lib
6767
/usr/local/lib
@@ -95,4 +95,4 @@ else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
9595
# show the LIBUSB_1_INCLUDE_DIRS and LIBUSB_1_LIBRARIES variables only in the advanced view
9696
mark_as_advanced(LIBUSB_1_INCLUDE_DIRS LIBUSB_1_LIBRARIES)
9797

98-
endif (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
98+
endif (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)

examples/CMakeLists.txt

100755100644
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,7 @@ else()
5656
find_package(OpenGL REQUIRED)
5757
find_package(GLUT REQUIRED)
5858

59-
include_directories(${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS} ${USB_INCLUDE_DIRS})
60-
61-
if (WIN32)
62-
set(MATH_LIB "")
63-
else(WIN32)
64-
set(MATH_LIB "m")
65-
endif()
59+
include_directories(${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR} ${USB_INCLUDE_DIRS})
6660

6761
target_link_libraries(glview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
6862
target_link_libraries(regview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})

examples/glview.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,27 @@ void keyPressed(unsigned char key, int x, int y)
179179
freenect_angle = -30;
180180
}
181181
}
182+
if (key == 'e') {
183+
static freenect_flag_value auto_exposure = FREENECT_ON;
184+
freenect_set_flag(f_dev, FREENECT_AUTO_EXPOSURE, auto_exposure);
185+
auto_exposure = !auto_exposure;
186+
}
187+
if (key == 'b') {
188+
static freenect_flag_value white_balance = FREENECT_ON;
189+
freenect_set_flag(f_dev, FREENECT_AUTO_WHITE_BALANCE, white_balance);
190+
white_balance = !white_balance;
191+
}
192+
if (key == 'r') {
193+
static freenect_flag_value raw_color = FREENECT_ON;
194+
freenect_set_flag(f_dev, FREENECT_RAW_COLOR, raw_color);
195+
raw_color = !raw_color;
196+
}
197+
if (key == 'm') {
198+
static freenect_flag_value mirror = FREENECT_ON;
199+
freenect_set_flag(f_dev, FREENECT_MIRROR_DEPTH, mirror);
200+
freenect_set_flag(f_dev, FREENECT_MIRROR_VIDEO, mirror);
201+
mirror = !mirror;
202+
}
182203
if (key == '1') {
183204
freenect_set_led(f_dev,LED_GREEN);
184205
}
@@ -349,6 +370,7 @@ void *freenect_threadfunc(void *arg)
349370
freenect_start_video(f_dev);
350371

351372
printf("'w'-tilt up, 's'-level, 'x'-tilt down, '0'-'6'-select LED mode, 'f'-video format\n");
373+
printf("'e' - auto exposure, 'b' - white balance, 'r' - raw color, 'm' - mirror\n");
352374

353375
while (!die && freenect_process_events(f_ctx) >= 0) {
354376
//Throttle the text output
@@ -421,17 +443,21 @@ int main(int argc, char **argv)
421443
if (argc > 1)
422444
user_device_number = atoi(argv[1]);
423445

424-
if (nr_devices < 1)
446+
if (nr_devices < 1) {
447+
freenect_shutdown(f_ctx);
425448
return 1;
449+
}
426450

427451
if (freenect_open_device(f_ctx, &f_dev, user_device_number) < 0) {
428452
printf("Could not open device\n");
453+
freenect_shutdown(f_ctx);
429454
return 1;
430455
}
431456

432457
res = pthread_create(&freenect_thread, NULL, freenect_threadfunc, NULL);
433458
if (res) {
434459
printf("pthread_create failed\n");
460+
freenect_shutdown(f_ctx);
435461
return 1;
436462
}
437463

examples/hiview.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,17 +445,21 @@ int main(int argc, char **argv)
445445
if (argc > 1)
446446
user_device_number = atoi(argv[1]);
447447

448-
if (nr_devices < 1)
448+
if (nr_devices < 1) {
449+
freenect_shutdown(f_ctx);
449450
return 1;
451+
}
450452

451453
if (freenect_open_device(f_ctx, &f_dev, user_device_number) < 0) {
452454
printf("Could not open device\n");
455+
freenect_shutdown(f_ctx);
453456
return 1;
454457
}
455458

456459
res = pthread_create(&freenect_thread, NULL, freenect_threadfunc, NULL);
457460
if (res) {
458461
printf("pthread_create failed\n");
462+
freenect_shutdown(f_ctx);
459463
return 1;
460464
}
461465

examples/micview.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,15 @@ int main(int argc, char** argv) {
161161

162162
int nr_devices = freenect_num_devices (f_ctx);
163163
printf ("Number of devices found: %d\n", nr_devices);
164-
if (nr_devices < 1)
164+
if (nr_devices < 1) {
165+
freenect_shutdown(f_ctx);
165166
return 1;
167+
}
166168

167169
int user_device_number = 0;
168170
if (freenect_open_device(f_ctx, &f_dev, user_device_number) < 0) {
169171
printf("Could not open device\n");
172+
freenect_shutdown(f_ctx);
170173
return 1;
171174
}
172175

@@ -188,6 +191,7 @@ int main(int argc, char** argv) {
188191
int res = pthread_create(&freenect_thread, NULL, freenect_threadfunc, NULL);
189192
if (res) {
190193
printf("pthread_create failed\n");
194+
freenect_shutdown(f_ctx);
191195
return 1;
192196
}
193197
printf("This is the libfreenect microphone waveform viewer. Press 'q' to quit or spacebar to pause/unpause the view.\n");

examples/regtest.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ FILE *open_dump(const char *filename)
4343

4444
void dump_depth(FILE *fp, void *data, unsigned int width, unsigned int height)
4545
{
46-
fprintf(fp, "P5 %d %d 65535\n", width, height);
46+
fprintf(fp, "P5 %u %u 65535\n", width, height);
4747
fwrite(data, width * height * 2, 1, fp);
4848
}
4949

5050
void dump_rgb(FILE *fp, void *data, unsigned int width, unsigned int height)
5151
{
52-
fprintf(fp, "P6 %d %d 255\n", width, height);
52+
fprintf(fp, "P6 %u %u 255\n", width, height);
5353
fwrite(data, width * height * 3, 1, fp);
5454
}
5555

examples/regview.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,17 +363,21 @@ int main(int argc, char **argv)
363363
if (argc > 1)
364364
user_device_number = atoi(argv[1]);
365365

366-
if (nr_devices < 1)
366+
if (nr_devices < 1) {
367+
freenect_shutdown(f_ctx);
367368
return 1;
369+
}
368370

369371
if (freenect_open_device(f_ctx, &f_dev, user_device_number) < 0) {
370372
printf("Could not open device\n");
373+
freenect_shutdown(f_ctx);
371374
return 1;
372375
}
373376

374377
res = pthread_create(&freenect_thread, NULL, freenect_threadfunc, NULL);
375378
if (res) {
376379
printf("pthread_create failed\n");
380+
freenect_shutdown(f_ctx);
377381
return 1;
378382
}
379383

examples/wavrecord.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,20 @@ int main(int argc, char** argv) {
8080

8181
int nr_devices = freenect_num_devices (f_ctx);
8282
printf ("Number of devices found: %d\n", nr_devices);
83-
if (nr_devices < 1)
83+
if (nr_devices < 1) {
84+
freenect_shutdown(f_ctx);
8485
return 1;
86+
}
8587

8688
int user_device_number = 0;
8789
if (freenect_open_device(f_ctx, &f_dev, user_device_number) < 0) {
8890
printf("Could not open device\n");
91+
freenect_shutdown(f_ctx);
8992
return 1;
9093
}
9194

9295
capture state;
96+
state.samples = 0;
9397
state.logfiles[0] = fopen("channel1.wav", "wb");
9498
state.logfiles[1] = fopen("channel2.wav", "wb");
9599
state.logfiles[2] = fopen("channel3.wav", "wb");
@@ -135,5 +139,6 @@ int main(int argc, char** argv) {
135139
fclose(state.logfiles[i]);
136140
}
137141

142+
freenect_shutdown(f_ctx);
138143
return 0;
139144
}

0 commit comments

Comments
 (0)