Skip to content

Commit c93f277

Browse files
PyrApplexlz
authored andcommitted
ProtonectSR: Make initial implementation of streamer-recorder.
@PyrApple: - first implementation of the real-time streamer: send kinect image via UDP socket to third party (e.g. to use in python). ## ONLY DEPTH FRAME SENT FOR NOW ## added example Blender (BGE) scene applying received image to object texture. - first implementation of the frame recorder: record kinect captured images to disk + time stamp for video creation. - ProtonectSR standalone toolbox creation: moved all code related to streamer and recorder to ./tools directory, reset of all changes made to other parts of the original libfreenect code. - ProtonectSR standalone toolbox creation: finished reset of original libfreenect code. @smokhov: - Remove .keep files, per @xlz. - [streamer] move .cpp our of include - [streamer][recorder] primarily copy-edited headers to match better project conventions; move data members to private sections - [docs] arrange include better with a comment - [sockets] add necessary include - [recorder] format better with project's coding conventions
1 parent d322e53 commit c93f277

File tree

12 files changed

+1769
-0
lines changed

12 files changed

+1769
-0
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12.1)
2+
3+
if(WIN32 AND NOT MINGW)
4+
if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
5+
set(CMAKE_DEBUG_POSTFIX "d")
6+
endif()
7+
endif()
8+
9+
IF(NOT DEFINED CMAKE_BUILD_TYPE)
10+
# No effect for multi-configuration generators (e.g. for Visual Studio)
11+
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose: RelWithDebInfo Release Debug MinSizeRel None")
12+
ENDIF()
13+
14+
PROJECT(libfreenect2_tools_SR)
15+
16+
SET(MY_DIR ${libfreenect2_tools_SR_SOURCE_DIR})
17+
SET(DEPENDS_DIR "${MY_DIR}/../../depends" CACHE STRING "Dependency directory")
18+
19+
OPTION(ENABLE_OPENGL "Enable OpenGL support" ON)
20+
21+
# The example build system is standalone and will work out-of-tree with these files copied
22+
SET(freenect2_ROOT_DIR ${MY_DIR}/../..)
23+
SET(flextGL_SOURCES ${freenect2_ROOT_DIR}/src/flextGL.cpp)
24+
SET(flextGL_INCLUDE_DIRS ${freenect2_ROOT_DIR}/src) # for flextGL.h
25+
SET(tools_SR_INCLUDE_DIRS ${MY_DIR}/include) # for local include
26+
SET(example_INCLUDE_DIRS ${freenect2_ROOT_DIR}/examples) # for protonect viewer
27+
28+
29+
FIND_PACKAGE(PkgConfig) # try find PKGConfig as it will be used if found
30+
LIST(APPEND CMAKE_MODULE_PATH ${freenect2_ROOT_DIR}/cmake_modules) # FindGLFW3.cmake
31+
32+
IF(TARGET freenect2)
33+
MESSAGE(STATUS "Using in-tree freenect2 target")
34+
SET(freenect2_LIBRARIES freenect2)
35+
SET(freenect2_DLLS ${LIBFREENECT2_DLLS})
36+
ELSE()
37+
FIND_PACKAGE(freenect2 REQUIRED)
38+
# Out-of-tree build will have to have DLLs manually copied.
39+
ENDIF()
40+
41+
INCLUDE_DIRECTORIES(
42+
${freenect2_INCLUDE_DIR}
43+
)
44+
45+
SET(ProtonectSR_src
46+
ProtonectSR.cpp
47+
)
48+
49+
SET(ProtonectSR_LIBRARIES
50+
${freenect2_LIBRARIES}
51+
)
52+
53+
SET(ProtonectSR_DLLS
54+
${freenect2_DLLS}
55+
)
56+
57+
IF(ENABLE_OPENGL)
58+
FIND_PACKAGE(GLFW3)
59+
FIND_PACKAGE(OpenGL)
60+
IF(GLFW3_FOUND AND OPENGL_FOUND)
61+
INCLUDE_DIRECTORIES(
62+
${GLFW3_INCLUDE_DIRS}
63+
${flextGL_INCLUDE_DIRS}
64+
${tools_SR_INCLUDE_DIRS}
65+
${example_INCLUDE_DIRS}
66+
)
67+
68+
LIST(APPEND ProtonectSR_DLLS ${GLFW3_DLL})
69+
LIST(APPEND ProtonectSR_src
70+
${example_INCLUDE_DIRS}/viewer.cpp
71+
${tools_SR_INCLUDE_DIRS}/PracticalSocket.cpp
72+
${tools_SR_INCLUDE_DIRS}/streamer.cpp
73+
${tools_SR_INCLUDE_DIRS}/recorder.cpp
74+
${flextGL_SOURCES}
75+
)
76+
LIST(APPEND ProtonectSR_LIBRARIES
77+
${GLFW3_LIBRARIES}
78+
${OPENGL_gl_LIBRARY}
79+
)
80+
ADD_DEFINITIONS(-DEXAMPLES_WITH_OPENGL_SUPPORT=1)
81+
ENDIF()
82+
ENDIF(ENABLE_OPENGL)
83+
84+
ADD_EXECUTABLE(ProtonectSR
85+
${ProtonectSR_src}
86+
)
87+
88+
TARGET_LINK_LIBRARIES(ProtonectSR
89+
${ProtonectSR_LIBRARIES}
90+
)
91+
92+
IF(WIN32)
93+
INSTALL(TARGETS ProtonectSR DESTINATION bin)
94+
LIST(REMOVE_DUPLICATES ProtonectSR_DLLS)
95+
FOREACH(FILEI ${ProtonectSR_DLLS})
96+
ADD_CUSTOM_COMMAND(TARGET ProtonectSR POST_BUILD
97+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILEI} $<TARGET_FILE_DIR:ProtonectSR>
98+
)
99+
ENDFOREACH(FILEI)
100+
INSTALL(FILES ${ProtonectSR_DLLS} DESTINATION bin)
101+
ENDIF()
102+
103+
# Add OpenCV package dependency for udp-image-streaming
104+
find_package( OpenCV REQUIRED )
105+
target_link_libraries( ProtonectSR ${OpenCV_LIBS} )

0 commit comments

Comments
 (0)