Skip to content

Commit

Permalink
code
Browse files Browse the repository at this point in the history
Signed-off-by: Tanner Schmidt <[email protected]>
  • Loading branch information
tschmidt23 committed Apr 4, 2016
1 parent f02a25c commit 03320b9
Show file tree
Hide file tree
Showing 116 changed files with 23,465 additions and 0 deletions.
270 changes: 270 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
project("dart")
cmake_minimum_required(VERSION 2.8)

# build release if not explicitly told to build debug
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

# turn on c++11
add_definitions(-std=c++11)

# set CMakeModule path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/CMakeModules/")

# find packages with modules
find_package(CUDA REQUIRED)
find_package(PNG REQUIRED)
find_package(OpenGL REQUIRED QUIET)
find_package(GLUT REQUIRED)
find_package(GLEW REQUIRED)
find_package(DEPTHSENSE)
find_package(OpenNI2)

# find packages with pkg-config
find_package(PkgConfig)
pkg_check_modules(eigen3 REQUIRED eigen3)
pkg_check_modules(tinyxml REQUIRED tinyxml)
pkg_check_modules(matheval REQUIRED libmatheval)
pkg_check_modules(assimp assimp)

include_directories(
${eigen3_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
${GLEW_INCLUDE_DIRS}
${tinyxml_INCLUDE_DIR}
)
link_directories(${tinyxml_LIBRARY_DIRS})
link_libraries(
${PNG_LIBRARIES}
${OPENGL_LIBRARIES}
${GLUT_glut_LIBRARY}
${GLEW_LIBRARIES}
${tinyxml_LIBRARIES}
${matheval_LIBRARIES}
)

# set dart source
set(dart_src
${PROJECT_SOURCE_DIR}/src/tracker.h
${PROJECT_SOURCE_DIR}/src/tracker.cpp

${PROJECT_SOURCE_DIR}/src/geometry/distance_transforms.h
${PROJECT_SOURCE_DIR}/src/geometry/geometry.h
${PROJECT_SOURCE_DIR}/src/geometry/geometry.cpp
${PROJECT_SOURCE_DIR}/src/geometry/grid_2d.h
${PROJECT_SOURCE_DIR}/src/geometry/grid_3d.h
${PROJECT_SOURCE_DIR}/src/geometry/sdf.h
${PROJECT_SOURCE_DIR}/src/geometry/sdf.cpp
${PROJECT_SOURCE_DIR}/src/geometry/SE3.h
${PROJECT_SOURCE_DIR}/src/geometry/plane_fitting.h
${PROJECT_SOURCE_DIR}/src/geometry/plane_fitting.cpp

${PROJECT_SOURCE_DIR}/src/mesh/mesh.h
${PROJECT_SOURCE_DIR}/src/mesh/mesh.cpp
${PROJECT_SOURCE_DIR}/src/mesh/mesh_proc.h
${PROJECT_SOURCE_DIR}/src/mesh/mesh_proc.cpp
${PROJECT_SOURCE_DIR}/src/mesh/mesh_splat.h
${PROJECT_SOURCE_DIR}/src/mesh/mesh_splat.cpp
${PROJECT_SOURCE_DIR}/src/mesh/mesh_sample.h
${PROJECT_SOURCE_DIR}/src/mesh/mesh_sample.cpp
${PROJECT_SOURCE_DIR}/src/mesh/primitive_meshing.h
${PROJECT_SOURCE_DIR}/src/mesh/primitive_meshing.cpp

${PROJECT_SOURCE_DIR}/src/img_proc/bilateral_filter.h
${PROJECT_SOURCE_DIR}/src/img_proc/img_ops.h
${PROJECT_SOURCE_DIR}/src/img_proc/organized_point_cloud.h
${PROJECT_SOURCE_DIR}/src/img_proc/resampling.h

${PROJECT_SOURCE_DIR}/src/model/host_only_model.h
${PROJECT_SOURCE_DIR}/src/model/host_only_model.cpp
${PROJECT_SOURCE_DIR}/src/model/mirrored_model.h
${PROJECT_SOURCE_DIR}/src/model/mirrored_model.cpp
${PROJECT_SOURCE_DIR}/src/model/model.h
${PROJECT_SOURCE_DIR}/src/model/model.cpp

${PROJECT_SOURCE_DIR}/src/optimization/kernels/obsToMod.h
${PROJECT_SOURCE_DIR}/src/optimization/kernels/modToObs.h
${PROJECT_SOURCE_DIR}/src/optimization/kernels/intersection.h
${PROJECT_SOURCE_DIR}/src/optimization/kernels/raycast.h
${PROJECT_SOURCE_DIR}/src/optimization/contact_prior.cpp
${PROJECT_SOURCE_DIR}/src/optimization/optimization.h
${PROJECT_SOURCE_DIR}/src/optimization/optimizer.h
${PROJECT_SOURCE_DIR}/src/optimization/optimizer.cpp
${PROJECT_SOURCE_DIR}/src/optimization/point_2d_3d_prior.cpp
${PROJECT_SOURCE_DIR}/src/optimization/point_3d_3d_prior.cpp
${PROJECT_SOURCE_DIR}/src/optimization/prediction_renderer.h
${PROJECT_SOURCE_DIR}/src/optimization/prediction_renderer.cpp
${PROJECT_SOURCE_DIR}/src/optimization/priors.h

${PROJECT_SOURCE_DIR}/src/pose/pose.h
${PROJECT_SOURCE_DIR}/src/pose/pose.cpp
${PROJECT_SOURCE_DIR}/src/pose/pose_reduction.h

${PROJECT_SOURCE_DIR}/src/util/cuda_utils.h
${PROJECT_SOURCE_DIR}/src/util/dart_io.h
${PROJECT_SOURCE_DIR}/src/util/dart_io.cpp
${PROJECT_SOURCE_DIR}/src/util/dart_types.h
${PROJECT_SOURCE_DIR}/src/util/gl_dart.h
${PROJECT_SOURCE_DIR}/src/util/gl_dart.cpp
${PROJECT_SOURCE_DIR}/src/util/image_io.h
${PROJECT_SOURCE_DIR}/src/util/image_io.cpp
${PROJECT_SOURCE_DIR}/src/util/mirrored_memory.h
${PROJECT_SOURCE_DIR}/src/util/model_renderer.h
${PROJECT_SOURCE_DIR}/src/util/model_renderer.cpp
${PROJECT_SOURCE_DIR}/src/util/ostream_operators.h
${PROJECT_SOURCE_DIR}/src/util/ostream_operators.cpp
${PROJECT_SOURCE_DIR}/src/util/prefix.h
${PROJECT_SOURCE_DIR}/src/util/string_format.h
${PROJECT_SOURCE_DIR}/src/util/string_format.cpp
${PROJECT_SOURCE_DIR}/src/util/vector_type_template.h

${PROJECT_SOURCE_DIR}/src/visualization/color_ramps.h
${PROJECT_SOURCE_DIR}/src/visualization/data_association_viz.h
${PROJECT_SOURCE_DIR}/src/visualization/gradient_viz.h
${PROJECT_SOURCE_DIR}/src/visualization/matrix_viz.h
${PROJECT_SOURCE_DIR}/src/visualization/sdf_viz.h
)

set(cpu_specific_src
${PROJECT_SOURCE_DIR}/src/geometry/distance_transforms.cpp
${PROJECT_SOURCE_DIR}/src/img_proc/img_ops.cpp
${PROJECT_SOURCE_DIR}/src/img_proc/organized_point_cloud.cpp
${PROJECT_SOURCE_DIR}/src/img_proc/resampling.cpp

${PROJECT_SOURCE_DIR}/src/visualization/color_ramps.cpp
${PROJECT_SOURCE_DIR}/src/visualization/data_association_viz.cpp
${PROJECT_SOURCE_DIR}/src/visualization/gradient_viz.cpp
${PROJECT_SOURCE_DIR}/src/visualization/sdf_viz.cpp
)

set(gpu_specific_src
${PROJECT_SOURCE_DIR}/src/geometry/distance_transforms.cu
${PROJECT_SOURCE_DIR}/src/geometry/plane_fitting.cu

${PROJECT_SOURCE_DIR}/src/img_proc/bilateral_filter.cu
${PROJECT_SOURCE_DIR}/src/img_proc/img_ops.cu
${PROJECT_SOURCE_DIR}/src/img_proc/organized_point_cloud.cu
${PROJECT_SOURCE_DIR}/src/img_proc/resampling.cu

${PROJECT_SOURCE_DIR}/src/optimization/kernels/kernel_common.h
${PROJECT_SOURCE_DIR}/src/optimization/kernels/obsToMod.cu
${PROJECT_SOURCE_DIR}/src/optimization/kernels/modToObs.cu
${PROJECT_SOURCE_DIR}/src/optimization/kernels/intersection.cu
${PROJECT_SOURCE_DIR}/src/optimization/kernels/raycast.cu

${PROJECT_SOURCE_DIR}/src/visualization/color_ramps.cu
${PROJECT_SOURCE_DIR}/src/visualization/data_association_viz.cu
${PROJECT_SOURCE_DIR}/src/visualization/gradient_viz.cu
${PROJECT_SOURCE_DIR}/src/visualization/matrix_viz.cu
${PROJECT_SOURCE_DIR}/src/visualization/sdf_viz.cu
)

set(point_cloud_srcs
${PROJECT_SOURCE_DIR}/src/point_cloud_src/point_cloud_src.h
)

set(depth_source_src
${PROJECT_SOURCE_DIR}/src/depth_sources/depth_source.h
${PROJECT_SOURCE_DIR}/src/depth_sources/image_depth_source.h
)

# set conditional sources
if(OPENNI2_FOUND)
include_directories(${OPENNI2_INCLUDE_DIRS})
link_directories(${OPENNI2_REDIST_DIR})
link_libraries(${OPENNI2_LIBRARY})
set(depth_source_src
${depth_source_src}
${PROJECT_SOURCE_DIR}/src/depth_sources/openni_depth_source.h
${PROJECT_SOURCE_DIR}/src/depth_sources/openni_depth_source.cpp
)
endif()

if(DEPTHSENSE_FOUND)
add_definitions(-DHAS_INTEL)
include_directories(${DEPTHSENSE_INCLUDE_DIR})
link_libraries(${DEPTHSENSE_LIBRARIES})
set(depth_source_src
${depth_source_src}
${PROJECT_SOURCE_DIR}/src/depth_sources/depthsense_depth_source.h
${PROJECT_SOURCE_DIR}/src/depth_sources/depthsense_depth_source.cpp
)
endif()

if(PMD_FOUND)
set(depth_source_src
${depth_source_src}
${PROJECT_SOURCE_DIR}/src/depth_sources/pmd_depth_source.h
${PROJECT_SOURCE_DIR}/src/depth_sources/pmd_depth_source.cpp
)
endif()

if(assimp_FOUND)
link_libraries(${assimp_LIBRARIES})
include_directories(${assimp_INCLUDE_DIRS})
set(dart_src
${dart_src}
${PROJECT_SOURCE_DIR}/src/mesh/assimp_mesh_reader.h
${PROJECT_SOURCE_DIR}/src/mesh/assimp_mesh_reader.cpp
)
add_definitions(-DASSIMP_BUILD)
endif()

include_directories(${PROJECT_SOURCE_DIR}/src/)

# set up library output
set(BUILD_SHARED_LIBS ON)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

set(CUDA_NVCC_FLAGS "-arch=sm_35" "--use_fast_math" "-O3" "--ptxas-options=--verbose") # "-fmad=false" "-DTHRUST_DEVICE_BACKEND=THRUST_DEVICE_BACKEND_OMP"

# add library
if(CUDA_FOUND)
include_directories(${CUDA_TOOLKIT_ROOT_DIR}/samples/common/inc)
add_definitions(-DCUDA_BUILD)
cuda_add_library(${PROJECT_NAME} ${dart_src} ${point_cloud_srcs} ${depth_source_src} ${gpu_specific_src})
else()
add_library(${PROJECT_NAME} ${dart_src} ${point_cloud_srcs} ${depth_source_src} ${cpu_specific_src})
endif()

# testing
find_package(GTest)
set(BUILD_TESTS OFF CACHE BOOL "build the tests (requires gtest)")
if(${BUILD_TESTS} AND ${GTEST_FOUND})
message(STATUS "building tests")

find_package(Threads REQUIRED QUIET)

include_directories(${GTEST_INCLUDE_DIRS})
link_directories(${GTEST_LIBRARIES})
link_libraries(gtest pthread)

set(test_sources
test/test_model_jacobian.cpp
test/test_obs_to_mod_kernels.cpp
test/test_pose_reduction.cpp
test/test_voxelize.cpp
)

set(gpu_test_sources
test/test_model_jacobian.cu
test/test_mirrored_model.cpp
)

cuda_add_executable(
# executable
test
# main source
test/test_main.cpp
# test sources
${test_sources}
# other sources
${sources}
${gpu_sources}
${gpu_test_sources}
)
target_link_libraries(test dart)
endif()
35 changes: 35 additions & 0 deletions CMakeModules/FindDEPTHSENSE.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
################################################################################
# Find DEPTHSENSE
#
# DEPTHSENSE_FOUND - True if DepthSense was found
# DEPTHSENSE_INCLUDE_DIR - Directories containing the DepthSense include files
# DEPTHSENSE_LIBRARIES - Librarires needed to use DepthSense
#
################################################################################

IF (WIN32)
ELSE ()
FIND_PATH(DEPTHSENSE_INCLUDE_DIR DepthSense.hxx
/opt/DepthSenseSDK/include
/opt/softkinetic/DepthSenseSDK/include
${PROJECT_SOURCE_DIR}/external_lib/include
DOC "The directory where DepthSense.hxx resides"
)
FIND_LIBRARY(DEPTHSENSE_LIBRARIES
NAMES DepthSense
PATHS
/opt/DepthSenseSDK/lib/libDepthSense.so
/opt/softkinetic/DepthSenseSDK/lib/
${PROJECT_SOURCE_DIR}/external_lib/lib
DOC "The DepthSense library"
)
ENDIF()

IF(DEPTHSENSE_INCLUDE_DIR AND DEPTHSENSE_LIBRARIES)
SET(DEPTHSENSE_FOUND ON)
message(STATUS "DepthSense found: ${DEPTHSENSE_INCLUDE_DIR}")
ELSE()
SET(DEPTHSENSE_FOUND OFF)
ENDIF()

MARK_AS_ADVANCED(DEPTHSENSE_FOUND)
83 changes: 83 additions & 0 deletions CMakeModules/FindOpenNI2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
find_package(PkgConfig QUIET)

# Find LibUSB
if(NOT WIN32)
pkg_check_modules(PC_USB_10 libusb-1.0)
find_path(USB_10_INCLUDE_DIR libusb-1.0/libusb.h
HINTS ${PC_USB_10_INCLUDEDIR} ${PC_USB_10_INCLUDE_DIRS} "${USB_10_ROOT}" "$ENV{USB_10_ROOT}"
PATH_SUFFIXES libusb-1.0)

find_library(USB_10_LIBRARY
NAMES usb-1.0
HINTS ${PC_USB_10_LIBDIR} ${PC_USB_10_LIBRARY_DIRS} "${USB_10_ROOT}" "$ENV{USB_10_ROOT}"
PATH_SUFFIXES lib)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(USB_10 DEFAULT_MSG USB_10_LIBRARY USB_10_INCLUDE_DIR)

if(NOT USB_10_FOUND)
message(STATUS "OpenNI 2 disabled because libusb-1.0 not found.")
return()
else()
include_directories(SYSTEM ${USB_10_INCLUDE_DIR})
endif()
endif(NOT WIN32)

if(${CMAKE_VERSION} VERSION_LESS 2.8.2)
pkg_check_modules(PC_OPENNI2 libopenni2)
else()
pkg_check_modules(PC_OPENNI2 QUIET libopenni2)
endif()

set(OPENNI2_DEFINITIONS ${PC_OPENNI_CFLAGS_OTHER})

set(OPENNI2_SUFFIX)
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OPENNI2_SUFFIX 64)
endif(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)

find_path(OPENNI2_INCLUDE_DIRS OpenNI.h
PATHS
"$ENV{OPENNI2_INCLUDE${OPENNI2_SUFFIX}}" # Win64 needs '64' suffix
/usr/include/openni2 # common path for deb packages
)

find_library(OPENNI2_LIBRARY
NAMES OpenNI2 # No suffix needed on Win64
libOpenNI2 # Linux
PATHS "$ENV{OPENNI2_LIB${OPENNI2_SUFFIX}}" # Windows default path, Win64 needs '64' suffix
"$ENV{OPENNI2_REDIST}" # Linux install does not use a separate 'lib' directory
)

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY} ${LIBUSB_1_LIBRARIES})
else()
set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY})
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenNI2 DEFAULT_MSG OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)

mark_as_advanced(OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)

if(OPENNI2_FOUND)
# Add the include directories
set(OPENNI2_INCLUDE_DIRS ${OPENNI2_INCLUDE_DIR})
set(OPENNI2_REDIST_DIR $ENV{OPENNI2_REDIST${OPENNI2_SUFFIX}})
message(STATUS "OpenNI 2 found (include: ${OPENNI2_INCLUDE_DIRS}, lib: ${OPENNI2_LIBRARY}, redist: ${OPENNI2_REDIST_DIR})")
endif(OPENNI2_FOUND)
#find_path(OpenNI2_INCLUDE_DIR OpenNI.h
# /usr/local/OpenNI-2.2/Include
# /usr/local/OpenNI-2.1/Include

#)
#find_path(OpenNI2_LIBRARY_PATH libOpenNI2.so
# /usr/local/OpenNI-2.2/Redist
# /usr/local/OpenNI-2.1/Redist
#)
#if(OpenNI2_INCLUDE_DIR)
# set(OpenNI2_FOUND ON)
# set(OpenNI2_LIBRARIES libOpenNI2.so libOniFile.so libPS1080.so)
# set(OpenNI2_LIBRARY_COPY_PATH ${OpenNI2_LIBRARY_PATH}/OpenNI2)
# set(OpenNI2_DRIVER_LIBRARY_PATH ${OpenNI2_LIBRARY_PATH}/OpenNI2/Drivers)
#endif()
Loading

0 comments on commit 03320b9

Please sign in to comment.