victorprad / InfiniTAM

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

Compiling with Kinect 2 #44

Open Attreyu opened 8 years ago

Attreyu commented 8 years ago

I´ve compiled it without any moddifications, how do I compile it in order to use Kinect 2 ? in Windows, not Linux.

I have the Kinect2 driver for OpenNI2, and when I run Infinitam without specifying any parameters, it launches like this:

untitled

So it somehow detects the Kinect2 as an unofficial device.

But if I try to specify it to use Kinect2 as the OpenNI device, it says "trying MS Kinect 2 device - compiled without Kinect 2 support".

untitled2

What am I doing wrong ?

Also, how do I actually save the mesh (obj, ply, stl, etc.), since there are no keys defined for rendering or saving ?

MarTiXcz commented 8 years ago

Hi, I am trying to do the same thing. Just need to get PCD file from it :) It's in InfiniTAM-master\InfiniTAM\ITMLib\Utils\ITMLibDefines.h

/// Kinect2 support is disabled by default (to not add the Kinect2 SDK dependency)
#ifndef COMPILE_WITHOUT_Kinect2
#define COMPILE_WITHOUT_Kinect2
#endif

Also, I think you don't need to calibrate Kinect2 as it's using Kinect SDK instead of OpenNI. (use no arguments)

They commented out part of Kinect2Engine.cpp

Specifically: Kinect2Engine::getImages(...) in this commit. I will try to get it to work tomorrow. Or I will use OpenNI like you did (thanks btw, didn't know it would work with Kinect v2).

Saving

Based on UIEngine.cpp ln 211

case 'w':
        printf("saving mesh to disk ...");
        uiEngine->SaveSceneToMesh("mesh.stl");
        printf(" done\n");

So it's w key. There is also support for .OBJ just go to definition of SaveSceneToMesh (F12 in VS) and further.

MarkZurkberg commented 8 years ago

Have you tried to compile InfiniTAM in Ubuntu?

Attreyu commented 8 years ago

No, I need it in Windows.

connerbrooks commented 8 years ago

@Attreyu, @MarTiXcz have you taken a look at #33 and the associated PR: #34?

MarTiXcz commented 8 years ago

@connerbrooks +1. Thanks. I'm not sure how I missed that. I guess I was a bit tired.

MarkZurkberg commented 8 years ago

Hi, I am tryting to compile InfiniTAM also, and I came cross the same problems as yours. My Kinect 2 have connected with computer successfully, and I have installed OpenNI2 at C:\Programs Files\OpenNI2, (btw, when I use Cmake to configure and generate , Cmake GUI always said can't find OpenNI, and what's worse, I can't set the path that pointing OPENI_ROOT). The InfiniTAMcli.exe always said "compiled without Kinect 2 support" and "compiled without openNI support" . I wonder if you can tell me how you fixed this problem. Thanks! ^^ @Attreyu @MarTiXcz

connerbrooks commented 8 years ago

You need to make changes to FindOpenNI.cmake. It does not work by default, this version includes modifications to make it work on windows.

MarkZurkberg commented 8 years ago

Thanks! ^_^ I checked FindOpenNI.cmake, and I notice there is a line of code said "OPEN_NI_ROOT /usr/local" . I think this is the key, and I should set "usr/local" to my OpenNI path "c:/pragram files/openni2", right? @connerbrooks

connerbrooks commented 8 years ago

You may need to make a few more changes to match the folder structure of the binary installation, but those are present in the modified version in my gist.

mississippia commented 1 year ago

I linked freenect2 to infiniTAM on linux. tested as following image: infiniTAM_pc

you are welcome to try my fix: InfiniTAM.zip