Skip to content

Commit 0b88567

Browse files
committed
Merge pull request #276 from kwaegel/openni2_pullrequest
OpenNI 2 grabber
2 parents 9de4beb + 0a7a0f3 commit 0b88567

Some content is hidden

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

41 files changed

+6466
-39
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ before_install:
4141
- sudo add-apt-repository ppa:libreoffice/ppa -y
4242
- sudo apt-get update -d
4343
install:
44-
- sudo apt-get install cmake libvtk5-qt4-dev libflann-dev libeigen3-dev libopenni-dev libqhull-dev libboost-filesystem1.53-dev libboost-iostreams1.53-dev libboost-thread1.53-dev
44+
- sudo apt-get install cmake libvtk5-qt4-dev libflann-dev libeigen3-dev libopenni-dev libqhull-dev libboost-filesystem1.53-dev libboost-iostreams1.53-dev libboost-thread1.53-dev libboost-chrono1.53-dev
4545
script:
4646
- bash .travis.sh

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,16 @@ if(WITH_OPENNI)
265265
endif(OPENNI_FOUND)
266266
endif(WITH_OPENNI)
267267

268+
# OpenNI 2
269+
option(WITH_OPENNI2 "OpenNI 2 driver support" TRUE)
270+
if(WITH_OPENNI2)
271+
find_package(OpenNI2)
272+
if (OPENNI2_FOUND)
273+
set(HAVE_OPENNI2 ON)
274+
include_directories(SYSTEM ${OPENNI2_INCLUDE_DIRS})
275+
endif(OPENNI2_FOUND)
276+
endif(WITH_OPENNI2)
277+
268278
# Fotonic (FZ_API)
269279
option(WITH_FZAPI "Build Fotonic Camera support" TRUE)
270280
if(WITH_FZAPI)

PCLConfig.cmake.in

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,43 @@ macro(find_openni)
211211
endif(OPENNI_FOUND)
212212
endmacro(find_openni)
213213

214+
#remove this as soon as openni2-dev is shipped with FindOpenni2.cmake
215+
macro(find_openni2)
216+
if(NOT OPENNI2_ROOT AND ("ON" STREQUAL "ON"))
217+
get_filename_component(OPENNI2_LIBRARY_HINT "OPENNI_LIBRARY-NOTFOUND" PATH)
218+
endif(NOT OPENNI2_ROOT AND ("ON" STREQUAL "ON"))
219+
220+
set(OPENNI2_SUFFIX)
221+
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
222+
set(OPENNI2_SUFFIX 64)
223+
endif(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
224+
225+
if(PKG_CONFIG_FOUND)
226+
pkg_check_modules(PC_OPENNI2 openni2-dev)
227+
endif(PKG_CONFIG_FOUND)
228+
229+
find_path(OPENNI2_INCLUDE_DIRS OpenNI.h
230+
HINTS /usr/include/openni2 /usr/include/ni2
231+
PATHS "$ENV{OPENNI2_INCLUDE${OPENNI2_SUFFIX}}"
232+
PATH_SUFFIXES openni openni2 include Include)
233+
234+
find_library(OPENNI2_LIBRARY
235+
NAMES OpenNI2 # No suffix needed on Win64
236+
HINTS /usr/lib
237+
PATHS "$ENV{OPENNI2_LIB${OPENNI2_SUFFIX}}"
238+
PATH_SUFFIXES lib Lib Lib64)
239+
240+
include(FindPackageHandleStandardArgs)
241+
find_package_handle_standard_args(OpenNI2 DEFAULT_MSG OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)
242+
243+
if(OPENNI2_FOUND)
244+
get_filename_component(OPENNI_LIBRARY_PATH ${OPENNI2_LIBRARY} PATH)
245+
set(OPENNI2_LIBRARY_DIRS ${OPENNI2_LIBRARY_PATH})
246+
set(OPENNI2_LIBRARIES "${OPENNI2_LIBRARY}")
247+
set(OPENNI2_REDIST_DIR $ENV{OPENNI2_REDIST${OPENNI2_SUFFIX}})
248+
endif(OPENNI2_FOUND)
249+
endmacro(find_openni2)
250+
214251
#remove this as soon as flann is shipped with FindFlann.cmake
215252
macro(find_flann)
216253
if(PCL_ALL_IN_ONE_INSTALLER)
@@ -404,6 +441,8 @@ macro(find_external_library _component _lib _is_optional)
404441
find_qhull()
405442
elseif("${_lib}" STREQUAL "openni")
406443
find_openni()
444+
elseif("${_lib}" STREQUAL "openni2")
445+
find_openni2()
407446
elseif("${_lib}" STREQUAL "vtk")
408447
find_VTK()
409448
elseif("${_lib}" STREQUAL "libusb-1.0")
@@ -680,7 +719,7 @@ endif(NOT "${PCL_DEFINITIONS}" STREQUAL "")
680719
pcl_remove_duplicate_libraries(PCL_LIBRARIES PCL_DEDUP_LIBRARIES)
681720
set(PCL_LIBRARIES ${PCL_DEDUP_LIBRARIES})
682721
# Add 3rd party libraries, as user code might include our .HPP implementations
683-
list(APPEND PCL_LIBRARIES ${BOOST_LIBRARIES} ${QHULL_LIBRARIES} ${OPENNI_LIBRARIES} ${FLANN_LIBRARIES} ${VTK_LIBRARIES})
722+
list(APPEND PCL_LIBRARIES ${BOOST_LIBRARIES} ${QHULL_LIBRARIES} ${OPENNI_LIBRARIES} ${OPENNI2_LIBRARIES} ${FLANN_LIBRARIES} ${VTK_LIBRARIES})
684723

685724
find_package_handle_standard_args(PCL DEFAULT_MSG PCL_LIBRARIES PCL_INCLUDE_DIRS)
686725
mark_as_advanced(PCL_LIBRARIES PCL_INCLUDE_DIRS PCL_LIBRARY_DIRS)

cmake/Modules/FindOpenNI2.cmake

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
###############################################################################
2+
# Find OpenNI 2
3+
#
4+
# This sets the following variables:
5+
# OPENNI2_FOUND - True if OPENNI 2 was found.
6+
# OPENNI2_INCLUDE_DIRS - Directories containing the OPENNI 2 include files.
7+
# OPENNI2_LIBRARIES - Libraries needed to use OPENNI 2.
8+
# OPENNI2_DEFINITIONS - Compiler flags for OPENNI 2.
9+
#
10+
# For libusb-1.0, add USB_10_ROOT if not found
11+
12+
find_package(PkgConfig QUIET)
13+
14+
# Find LibUSB
15+
if(NOT WIN32)
16+
pkg_check_modules(PC_USB_10 libusb-1.0)
17+
find_path(USB_10_INCLUDE_DIR libusb-1.0/libusb.h
18+
HINTS ${PC_USB_10_INCLUDEDIR} ${PC_USB_10_INCLUDE_DIRS} "${USB_10_ROOT}" "$ENV{USB_10_ROOT}"
19+
PATH_SUFFIXES libusb-1.0)
20+
21+
find_library(USB_10_LIBRARY
22+
NAMES usb-1.0
23+
HINTS ${PC_USB_10_LIBDIR} ${PC_USB_10_LIBRARY_DIRS} "${USB_10_ROOT}" "$ENV{USB_10_ROOT}"
24+
PATH_SUFFIXES lib)
25+
26+
include(FindPackageHandleStandardArgs)
27+
find_package_handle_standard_args(USB_10 DEFAULT_MSG USB_10_LIBRARY USB_10_INCLUDE_DIR)
28+
29+
if(NOT USB_10_FOUND)
30+
message(STATUS "OpenNI 2 disabled because libusb-1.0 not found.")
31+
return()
32+
else()
33+
include_directories(SYSTEM ${USB_10_INCLUDE_DIR})
34+
endif()
35+
endif(NOT WIN32)
36+
37+
if(${CMAKE_VERSION} VERSION_LESS 2.8.2)
38+
pkg_check_modules(PC_OPENNI2 openni2-dev)
39+
else()
40+
pkg_check_modules(PC_OPENNI2 QUIET openni2-dev)
41+
endif()
42+
43+
set(OPENNI2_DEFINITIONS ${PC_OPENNI_CFLAGS_OTHER})
44+
45+
set(OPENNI2_SUFFIX)
46+
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
47+
set(OPENNI2_SUFFIX 64)
48+
endif(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
49+
50+
find_path(OPENNI2_INCLUDE_DIRS OpenNI.h
51+
PATHS
52+
"$ENV{OPENNI2_INCLUDE${OPENNI2_SUFFIX}}" # Win64 needs '64' suffix
53+
/usr/include/openni2 # common path for deb packages
54+
)
55+
56+
find_library(OPENNI2_LIBRARY
57+
NAMES OpenNI2 # No suffix needed on Win64
58+
libOpenNI2 # Linux
59+
PATHS "$ENV{OPENNI2_LIB${OPENNI2_SUFFIX}}" # Windows default path, Win64 needs '64' suffix
60+
"$ENV{OPENNI2_REDIST}" # Linux install does not use a separate 'lib' directory
61+
)
62+
63+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
64+
set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY} ${LIBUSB_1_LIBRARIES})
65+
else()
66+
set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY})
67+
endif()
68+
69+
include(FindPackageHandleStandardArgs)
70+
find_package_handle_standard_args(OpenNI2 DEFAULT_MSG OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)
71+
72+
mark_as_advanced(OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)
73+
74+
if(OPENNI2_FOUND)
75+
# Add the include directories
76+
set(OPENNI2_INCLUDE_DIRS ${OPENNI2_INCLUDE_DIR})
77+
set(OPENNI2_REDIST_DIR $ENV{OPENNI2_REDIST${OPENNI2_SUFFIX}})
78+
message(STATUS "OpenNI 2 found (include: ${OPENNI2_INCLUDE_DIRS}, lib: ${OPENNI2_LIBRARY}, redist: ${OPENNI2_REDIST_DIR})")
79+
endif(OPENNI2_FOUND)
80+

cmake/pcl_find_boost.cmake

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ endif(${CMAKE_VERSION} VERSION_LESS 2.8.5)
2323
set(Boost_NO_BOOST_CMAKE ON)
2424

2525
# Optional boost modules
26-
find_package(Boost 1.40.0 QUIET COMPONENTS serialization mpi)
26+
find_package(Boost 1.47.0 QUIET COMPONENTS serialization mpi)
2727
if(Boost_MPI_FOUND)
2828
set(BOOST_MPI_FOUND TRUE)
2929
endif(Boost_MPI_FOUND)
@@ -32,15 +32,9 @@ if(Boost_SERIALIZATION_FOUND)
3232
endif(Boost_SERIALIZATION_FOUND)
3333

3434
# Required boost modules
35-
set(BOOST_REQUIRED_MODULES system filesystem thread date_time iostreams)
36-
# Starting with Boost 1.50, boost_thread depends on chrono. As this is not
37-
# taken care of automatically on Windows, we add an explicit dependency as a
38-
# workaround.
39-
if(WIN32 AND Boost_VERSION VERSION_GREATER "104900")
40-
set(BOOST_REQUIRED_MODULES ${BOOST_REQUIRED_MODULES} chrono)
41-
endif(WIN32 AND Boost_VERSION VERSION_GREATER "104900")
35+
set(BOOST_REQUIRED_MODULES system filesystem thread date_time iostreams chrono)
4236

43-
find_package(Boost 1.40.0 REQUIRED COMPONENTS ${BOOST_REQUIRED_MODULES})
37+
find_package(Boost 1.47.0 REQUIRED COMPONENTS ${BOOST_REQUIRED_MODULES})
4438

4539
if(Boost_FOUND)
4640
set(BOOST_FOUND TRUE)

gpu/people/tools/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ include_directories(${VTK_INCLUDE_DIRS})
1616
#PCL_ADD_EXECUTABLE("${the_target}" "${SUBSYS_NAME}" people_tracking.cpp)
1717
#target_link_libraries("${the_target}" pcl_common pcl_filters pcl_kdtree pcl_segmentation pcl_kdtree pcl_gpu_people pcl_filters pcl_io pcl_visualization)
1818

19-
PCL_ADD_EXECUTABLE(pcl_people_app "${SUBSYS_NAME}" people_app.cpp)
20-
target_link_libraries (pcl_people_app pcl_common pcl_filters pcl_kdtree pcl_segmentation pcl_kdtree pcl_gpu_people pcl_filters pcl_io pcl_visualization ${Boost_LIBRARIES})
19+
if (HAVE_OPENNI)
20+
PCL_ADD_EXECUTABLE(pcl_people_app "${SUBSYS_NAME}" people_app.cpp)
21+
target_link_libraries (pcl_people_app pcl_common pcl_filters pcl_kdtree pcl_segmentation pcl_kdtree pcl_gpu_people pcl_filters pcl_io pcl_visualization ${Boost_LIBRARIES})
22+
endif (HAVE_OPENNI)
2123

2224
PCL_ADD_EXECUTABLE(pcl_people_pcd_prob "${SUBSYS_NAME}" people_pcd_prob.cpp)
2325
target_link_libraries (pcl_people_pcd_prob pcl_common pcl_filters pcl_kdtree pcl_segmentation pcl_kdtree pcl_gpu_people pcl_filters pcl_io pcl_visualization ${Boost_LIBRARIES})

0 commit comments

Comments
 (0)