victorprad / InfiniTAM

A Framework for the Volumetric Integration of Depth Images
http://www.infinitam.org
Other
941 stars 353 forks source link

How to configure OpenNI in Ubuntu14.04 #45

Open MarkZurkberg opened 8 years ago

MarkZurkberg commented 8 years ago

I use Ubuntu14.04 to compile InfiniTAM, with OpenNI files downloaded from http://structure.io/openni, but I don't know what I should do with these files.

connerbrooks commented 8 years ago

You can either grab the binaries from structure's site or build from source (I would recommend using its develop branch). When you invoke cmake provide the path as described in the readme build process section.

AbyssGaze commented 7 years ago

When you build the project in ubuntu 14.04, you need to amend the FindOpenNI.cmake file in the folder of /InfiniTAM/InfiniTAM/cmake . In FindOpenNI.cmake you can find the lib and include path of openni, and you need to amend it to correct path. As my openni2 installed, the include file in /usr/include/openni2 and the lib file in /usr/lib/OpenNI2, that change find_library NAMES OpenNI to OpenNI2 and the find_path(OpenNI_INCLUDE_DIR OpenNI.h PATH "${OPEN_NI_ROOT}/include/openni2") and find_library(OpenNI_LIBRARY OpenNI2 PATH "${OPEN_NI_ROOT}/lib") and then into build folder, cmake -DOPEN_NI_ROOT=/usr you will find the output OPENNI true, and make -j After that you can run xtion in you ubuntu in real time: ./InfiniTAM ../Files/Teddy/calib.txt

ravich2-7183 commented 7 years ago

This worked for me (Ubuntu 14.04 + Kinect-1):

  1. Install libfreenect and test that OpenNI2 works Install libfreenect from https://github.com/OpenKinect/libfreenect and follow the instructions here (https://github.com/OpenKinect/libfreenect/tree/master/OpenNI2-FreenectDriver) for installing the libFreenectDriver in the OpenNI2 drivers folder.

Test by running /path/to/OpenNI2/Bin/x64-Release/SimpleViewer or NiViewer.

  1. Ensure that Inifitam picks up the right libOpenNI2.so Use ldd ./Infinitam to check that the libOpenNI2.so points to the one compiled from https://github.com/occipital/OpenNI2 or downloaded from https://structure.io/openni

something like: libOpenNI2.so => /path/to/OpenNI2/Bin/x64-Release/libOpenNI2.so (0x00007f85c7cdb000)

You can ensure that this is the case by using: cmake ../InfiniTAM -DOPEN_NI_ROOT=/path/to/OpenNI2/

Also set OPENNI_LIBRARY to /path/to/OpenNI2/Bin/x64-Release/libOpenNI2.so using ccmake or cmake-gui (somehow I couldn't set it from the command line).

billamiable commented 7 years ago

@AbyssGaze @MarkZurkberg Hi, I tried to amend the FindOpenNI.cmake in Ubuntu 16.04 but all failed. Could you please share your cmake file to me? Thanks a lot.

I figured out the problem! It lies in the different variable name in FindOpenNI.cmake and UseOpenNI.cmake. It is OPEN_NI_ROOT in FindOpenNI.cmake but OPENNI_ROOT in UseOpenNI.cmake. Therefore, after changing the name of OPEN_NI_ROOT to OPENNI_ROOT in FindOpenNI.cmake, and using cmake .. -DOPENNI_ROOT=/path/to/openni. The problem is solved!