Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OpennNI 2 driver #4

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 85 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,92 @@
CXX = nvcc
CC = nvcc
CPPFLAGS=-I../include -I../include/libfreenect -I/usr/loca/cuda/include -I/opt/local/include -DLIBFREENECT_INTERFACE
CXXFLAGS=-g -m64 -O3 -use_fast_math
## -ptx -src-in-ptx
LDFLAGS=-g -m64 -L../lib -lfreenect -Xlinker -framework,OpenGL,-framework,GLUT
# When editing this Makefile, please make sure all variables apart from
# the KF_* and ALL_* variables stay overridable from outside.
# KF_* variables *may* be set from outside (like KF_DRIVER).

%.o: %.cu
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $^
CC ?= gcc
CXX ?= g++
NVCC ?= nvcc

# Can be either 'libfreenect' or 'openni2'.
# If not given, it's 'libfreenect' by default.
KF_DRIVER ?= libfreenect

# You can set the following path variables for this Makefile:
# CUDA_INCLUDE_PATH
# OPENNI2_INCLUDE_PATH
# LIBFREENECT_INCLUDE_PATH


# Default flags
KF_CPPFLAGS = -Ithirdparty
KF_CXXFLAGS = -g -m64 -O3
KF_NVCCFLAGS = -g -m64 -O3 -use_fast_math
KF_LDFLAGS = -g -m64 -lpthread -Xlinker -lcudart

ifdef CUDA_INCLUDE_PATH
KF_CPPFLAGS += -I$(CUDA_INCLUDE_PATH)
endif

# Driver dependent flags

# For using libfreenect
ifeq ($(KF_DRIVER),libfreenect)
KF_CPPFLAGS += -DLIBFREENECT_INTERFACE
ifdef LIBFREENECT_INCLUDE_PATH
KF_CPPFLAGS += -I$(LIBFREENECT_INCLUDE_PATH)
endif
KF_LDFLAGS += -lfreenect
# For using OpenNI2
else ifeq ($(KF_DRIVER),openni2)
KF_CPPFLAGS += -DOPENNI2_INTERFACE
ifdef OPENNI2_INCLUDE_PATH
KF_CPPFLAGS += -I$(OPENNI2_INCLUDE_PATH)
endif
KF_LDFLAGS += -lOpenNI2
else
$(error KF_DRIVER is not set to a possible driver)
endif

# OS dependent flags

KF_OS := $(shell uname)
ifeq ($(KF_OS),Darwin)
KF_LDFLAGS += -framework,OpenGL,-framework,GLUT
else
KF_LDFLAGS += -lGL -lglut
endif


# Concatenate our and user flags
ALL_CPPFLAGS := $(KF_CPPFLAGS) $(CPPFLAGS)
ALL_CXXFLAGS := $(KF_CXXFLAGS) $(CXXFLAGS)
ALL_NVCCFLAGS := $(KF_NVCCFLAGS) $(NVCCFLAGS)
ALL_LDFLAGS := $(KF_LDFLAGS) $(LDFLAGS)


# Default target
.PHONY: all
all: kinect test

test: kfusion.o helpers.o test.o

kinect: kfusion.o helpers.o kinect.o interface.o
# .cpp files
%.o: %.cpp
$(CXX) $(ALL_CXXFLAGS) $(ALL_CPPFLAGS) -c -o $@ $<

# .cu files
%.cu_o: %.cu
$(NVCC) $(ALL_NVCCFLAGS) $(ALL_CPPFLAGS) -c -o $@ $<


# Executables

kinect: kinect.cpp kfusion.cu_o helpers.cu_o interface.o
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $^ -o $@ $(ALL_LDFLAGS)

test: test.cpp kfusion.cu_o helpers.cu_o
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $^ -o $@ $(ALL_LDFLAGS)


# Cleanup
.PHONY: clean
clean:
rm *.o test kinect
rm -f *.cu_o *.o test kinect
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ KFusion is mainly written in CUDA with some interface code to display graphics o
Requirements
------------

You need a depth camera: Either a Microsoft Kinect or any camera supported
by OpenNI 2 (such as the Asus Xtion Pro Live).

KFusion depends on the following libraries:

* http://www.edwardrosten.com/cvd/toon.html
Expand All @@ -25,9 +28,10 @@ On Windows use the MS Kinect SDK:

* http://www.microsoft.com/en-us/kinectforwindows/develop/overview.aspx

while on other platforms use libfreenect:
while on other platforms use either:

* http://openkinect.org/
* libfreenect: http://openkinect.org or
* OpenNI: https://github.com/OpenNI/OpenNI2

and of course the CUDA 5 SDK by NVidia

Expand Down
Loading