Skip to content

Example Applications

dorian3d edited this page Nov 18, 2014 · 8 revisions

Single Test

The Single Test applications allows to run KinectFusion with Kangaroo in a single computer from one or several cameras at the same time.

Steps:

  1. Arrange one or several Kinect2 cameras in fixed positions and connect them to the same computer.

  2. Calibrate the infrared cameras of the Kinect2's at the same time. Check the Calibration documentation. Use one of these files instead of the ones generated by Vicalib to get marks for the Vicon markers: small pattern, medium pattern, large pattern.

  3. Run the SingleTest application. For example, to use two Kinect2 cameras with the calibration file cameras.xml obtained in the step 2:

     ./singletest -cam freenect2:[rgb=0,ir=0,depth=1]// -cmod cameras.xml
    

You should see the GUI application with the depth images and the reconstructed 3D volume: Single Test

  1. Activate the fuse option to run the 3D fusion. Deactivate the view only option at some moment to fully render the reconstructed scene.

Usual problems

Kangaroo makes an intensive use of the GPU, requiring a large amount of video memory. You may need to free video memory if you get an error like this:

188 MB Video Memory Available.
terminate called after throwing an instance of 'roo::CudaException'
  what():  CudaException: Unable to cudaMallocPitch
cudaError code: out of memory (2)
Abort trap: 6

These tricks have been seen to work to free video memory:

  • On Mac, activate the Automatic graphics switching option in the Energy Saver tab in System Preferences.
  • Close Google Chrome, Firefox or any other browser.
  • Plug or unplug an external screen.
  • Close the laptop lid and open it again.

SingleTest with remote cameras

These examples shows how to run KinectFusion by acquiring images from cameras over the network. For that, you need several computers connected to the same local network.

Master computer and one auxiliary computer

In this example, we suppose there is an auxiliary computer with one or several computers connected to it and a master computer that performs the 3D reconstruction.

Steps for the auxiliary machine connected to the cameras
  1. Calibrate the cameras as in the section above.

  2. Locate the HAL application CamToNode (HAL/Applications/CamToNode).

  3. Run the program:

     ./CamToNode -node camera_node -topic images -fps 30 -cam freenect2:[rgb=0,ir=0,depth=1]//
    

This will export depth images to the local network through the address camera_node/images.

Steps for the master machine performing the 3D reconstruction
  1. Run SingleTest with the driver node and the cameras.xml calibration file obtained in the previous step 1:

     ./singletest -cam node://camera_node/images -cmod cameras.xml
    
  2. Use the fuse and view only options to see the output.

Master computer and several auxiliary computers

In this example, we suppose there is several auxiliary computers with one or several computers connected to them and a master computer that performs the 3D reconstruction.

Before going on, calibrate the remote cameras to generate a cameras.xml file.

Steps for the i-th auxiliary machine connected to cameras
  1. Run the CamToNode program, changing the node name camera_i to an unique name, e.g. camera_1, camera_2, etc:

     ./CamToNode -node camera_i -topic images -fps 30 -cam freenect2:[rgb=0,ir=0,depth=1]//
    

This will export depth images to the local network through the address camera_i/images.

Steps for the master machine performing the 3D reconstruction
  1. Run SingleTest with the join driver to join several node drivers and with the cameras.xml calibration file obtained before. For example, if there are two auxiliary computers publishing images, you may do:

     ./singletest -cam "join://node://camera_1/images&node://camera_2/images" -cmod cameras.xml
    

You can concatenate as node drivers as necessary for any arbitrary number of auxiliary computers by separating them with the & character. Note that the value of the -cam argument must be between quotes to escape the &.

  1. Use the fuse and view only options to see the output.