Skip to content

Commit ed5155e

Browse files
committed
Merge commit 'v0.1.2' into dfsg
2 parents 5f60d22 + 3629b75 commit ed5155e

71 files changed

Lines changed: 5974 additions & 2289 deletions

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ obj/
2929
_ReSharper*/
3030
[Tt]est[Rr]esult*
3131
build
32+
/results/

CMakeLists.txt

Lines changed: 7 additions & 2 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 0)
45-
set (PROJECT_VER_PATCH 1)
44+
set (PROJECT_VER_MINOR 1)
45+
set (PROJECT_VER_PATCH 2)
4646
set (PROJECT_VER
4747
"${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}.${PROJECT_VER_PATCH}")
4848
set (PROJECT_APIVER
@@ -98,6 +98,10 @@ SET(DOC_OUTPUT_PATH ${CMAKE_BINARY_DIR}/doc)
9898
if(CMAKE_C_FLAGS STREQUAL "")
9999
set(CMAKE_C_FLAGS "-O2")
100100
endif()
101+
SET(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG=1")
102+
SET(CMAKE_C_FLAGS_RELEASE "-O2")
103+
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
104+
101105
add_definitions(-Wall)
102106

103107
# Pretty much everyone is going to need the main includes
@@ -182,6 +186,7 @@ IF ( BUILD_CPACK )
182186
INSTALL(FILES "include/libfreenect-audio.h" DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR})
183187
endif()
184188
INSTALL(FILES "include/libfreenect.h" DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR})
189+
INSTALL(FILES "include/libfreenect-registration.h" DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR})
185190
INSTALL(FILES "APACHE20" DESTINATION "share/doc/${CPACK_PACKAGE_NAME}")
186191
INSTALL(FILES "GPL2" DESTINATION "share/doc/${CPACK_PACKAGE_NAME}")
187192
INSTALL(FILES "README.asciidoc" DESTINATION "share/doc/${CPACK_PACKAGE_NAME}")

HACKING

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ the body.
5757

5858
Functions should have the opening brace on the next line, like this:
5959

60-
void foo(int a_thing, int something_else)
61-
{
62-
...
63-
}
60+
void foo(int a_thing, int something_else)
61+
{
62+
...
63+
}
6464

6565
No-args functions should be (void), and function arguments should be separated
6666
with a space after the comma, like this:
6767

68-
void baz(void)
69-
{
70-
foo(bluh, blah);
71-
}
68+
void baz(void)
69+
{
70+
foo(bluh, blah);
71+
}
7272

7373
Try to avoid having excessively long function names (abbreviating is fine) and
7474
don't make multiple functions that do essentially the same thing (and certainly
@@ -78,7 +78,25 @@ In general, for data obtained with the Kinect, we'll provide a raw and a
7878
"cooked" variant, where it makes sense, but we don't need to support every
7979
"cooked" value convention under the sun.
8080

81-
== WHITESPACE ===
81+
=== WHITESPACE ===
8282

8383
Avoid trailing whitespace. No lines should end in a tab or a space. Keep a
8484
newline (blank line) at the end of each file.
85+
86+
=== DEBUG BUILD ===
87+
88+
In order to build the binaries with debug symbols the following commands
89+
can be used:
90+
91+
$ mkdir build
92+
$ cd build
93+
$ cmake ../ -DCMAKE_BUILD_TYPE=debug
94+
$ make
95+
96+
If you want to build in release mode (with optimizations) but still have debug
97+
symbols, try RelWithDebInfo:
98+
99+
$ mkdir build
100+
$ cd build
101+
$ cmake ../ -DCMAKE_BUILD_TYPE=RelWithDebInfo
102+
$ make

README.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ directory for them:
131131
- python
132132
- actionscript
133133
- C#
134+
- Java (JNA)
134135

135136
=== Licensing
136137

examples/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(CMAKE_C_FLAGS "-Wall")
66

77
if (WIN32)
88
set_source_files_properties(glview.c PROPERTIES LANGUAGE CXX)
9+
set_source_files_properties(regview.c PROPERTIES LANGUAGE CXX)
910
set_source_files_properties(glpclview.c PROPERTIES LANGUAGE CXX)
1011
set_source_files_properties(hiview.c PROPERTIES LANGUAGE CXX)
1112
set_source_files_properties(tiltdemo.c PROPERTIES LANGUAGE CXX)
@@ -17,6 +18,7 @@ if (WIN32)
1718
endif()
1819

1920
add_executable(glview glview.c)
21+
add_executable(regview regview.c)
2022
add_executable(hiview hiview.c)
2123
if(BUILD_AUDIO)
2224
add_executable(wavrecord wavrecord.c)
@@ -26,6 +28,7 @@ endif()
2628
if (BUILD_C_SYNC)
2729
add_executable(glpclview glpclview.c)
2830
add_executable(tiltdemo tiltdemo.c)
31+
add_executable(regtest regtest.c)
2932
endif()
3033

3134
# We need to include libfreenect_sync.h for glpclview
@@ -35,6 +38,7 @@ include_directories (../wrappers/c_sync/)
3538
if(APPLE)
3639
set(CMAKE_EXE_LINKER_FLAGS "-framework OpenGL -framework GLUT")
3740
target_link_libraries(glview freenect)
41+
target_link_libraries(regview freenect)
3842
target_link_libraries(hiview freenect)
3943
if (BUILD_AUDIO)
4044
target_link_libraries(wavrecord freenect)
@@ -43,6 +47,7 @@ if(APPLE)
4347
if (BUILD_C_SYNC)
4448
target_link_libraries(glpclview freenect_sync)
4549
target_link_libraries(tiltdemo freenect_sync)
50+
target_link_libraries(regtest freenect_sync)
4651
endif()
4752
# Linux, not so much
4853
else()
@@ -60,6 +65,7 @@ else()
6065
endif()
6166

6267
target_link_libraries(glview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
68+
target_link_libraries(regview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
6369
target_link_libraries(hiview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
6470
if (BUILD_AUDIO)
6571
target_link_libraries(wavrecord freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
@@ -69,11 +75,12 @@ else()
6975
target_link_libraries(glpclview freenect_sync ${OPENGL_LIBRARIES} ${GLUT_LIBRARY}
7076
${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
7177
target_link_libraries(tiltdemo freenect_sync ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})
78+
target_link_libraries(regtest freenect_sync ${CMAKE_THREAD_LIBS_INIT})
7279
endif()
7380
endif()
7481

7582

76-
install (TARGETS glview hiview
83+
install (TARGETS glview regview hiview
7784
DESTINATION bin)
7885

7986
if (BUILD_C_SYNC)

examples/regtest.c

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/*
2+
* This file is part of the OpenKinect Project. http://www.openkinect.org
3+
*
4+
* Copyright (c) 2011 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+
#include <stdio.h>
28+
#include <stdlib.h>
29+
30+
#include "libfreenect.h"
31+
#include "libfreenect_sync.h"
32+
33+
FILE *open_dump(const char *filename)
34+
{
35+
FILE* fp = fopen(filename, "w");
36+
if (fp == NULL) {
37+
fprintf(stderr, "Error: Cannot open file [%s]\n", filename);
38+
exit(1);
39+
}
40+
printf("%s\n", filename);
41+
return fp;
42+
}
43+
44+
void dump_depth(FILE *fp, void *data, unsigned int width, unsigned int height)
45+
{
46+
fprintf(fp, "P5 %d %d 65535\n", width, height);
47+
fwrite(data, width * height * 2, 1, fp);
48+
}
49+
50+
void dump_rgb(FILE *fp, void *data, unsigned int width, unsigned int height)
51+
{
52+
fprintf(fp, "P6 %d %d 255\n", width, height);
53+
fwrite(data, width * height * 3, 1, fp);
54+
}
55+
56+
void no_kinect_quit(void)
57+
{
58+
fprintf(stderr, "Error: Kinect not connected?\n");
59+
exit(1);
60+
}
61+
62+
int main(void)
63+
{
64+
short *depth = 0;
65+
char *rgb = 0;
66+
uint32_t ts;
67+
FILE *fp;
68+
int ret;
69+
70+
ret = freenect_sync_get_video((void**)&rgb, &ts, 0, FREENECT_VIDEO_RGB);
71+
if (ret < 0)
72+
no_kinect_quit();
73+
74+
fp = open_dump("registration_test_rgb.ppm");
75+
dump_rgb(fp, rgb, 640, 480);
76+
fclose(fp);
77+
78+
ret = freenect_sync_get_depth((void**)&depth, &ts, 0, FREENECT_DEPTH_11BIT);
79+
if (ret < 0)
80+
no_kinect_quit();
81+
82+
fp = open_dump("registration_test_depth_raw.pgm");
83+
dump_depth(fp, depth, 640, 480);
84+
fclose(fp);
85+
86+
ret = freenect_sync_get_depth((void**)&depth, &ts, 0, FREENECT_DEPTH_REGISTERED);
87+
if (ret < 0)
88+
no_kinect_quit();
89+
90+
fp = open_dump("registration_test_depth_registered.pgm");
91+
dump_depth(fp, depth, 640, 480);
92+
fclose(fp);
93+
94+
ret = freenect_sync_get_depth((void**)&depth, &ts, 0, FREENECT_DEPTH_MM);
95+
if (ret < 0)
96+
no_kinect_quit();
97+
98+
fp = open_dump("registration_test_depth_mm.pgm");
99+
dump_depth(fp, depth, 640, 480);
100+
fclose(fp);
101+
102+
return 0;
103+
}

0 commit comments

Comments
 (0)