Coder Social home page Coder Social logo

tingzhushaohua / kinectfusionlib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chrdiller/kinectfusionlib

0.0 1.0 0.0 27 KB

Implementation of the KinectFusion approach in modern C++14 and CUDA

License: MIT License

CMake 1.36% C++ 33.42% Cuda 46.36% C 18.86%

kinectfusionlib's Introduction

KinectFusion

This is an implementation of KinectFusion, based on Newcombe, Richard A., et al. KinectFusion: Real-time dense surface mapping and tracking. It makes heavy use of graphics hardware and thus allows for real-time fusion of depth image scans. Furthermore, exporting of the resulting fused volume is possible either as a pointcloud or a dense surface mesh.

Features

  • Real-time fusion of depth scans and corresponding RGB color images
  • Easy to use, modern C++14 interface
  • Export of the resulting volume as pointcloud
  • Export also as dense surface mesh using the MarchingCubes algorithm
  • Functions for easy export of pointclouds and meshes into the PLY file format
  • Retrieval of calculated camera poses for further processing

Dependencies

  • GCC 5 as higher versions do not work with current nvcc (as of 2017).
  • CUDA 8.0. In order to provide real-time reconstruction, this library relies on graphics hardware. Running it exclusively on the CPU is not possible.
  • OpenCV 3.0 or higher. This library heavily depends on the GPU features of OpenCV that have been refactored in the 3.0 release. Therefore, OpenCV 2 is not supported.
  • Eigen3 for efficient matrix and vector operations.

Prerequisites

  • Adjust CUDA architecture: Set the CUDA architecture version to that of your graphics hardware SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3 -gencode arch=compute_52,code=sm_52) Tested with a nVidia GeForce 970, compute capability 5.2, Maxwell architecture
  • Set custom opencv path (if necessary): SET("OpenCV_DIR" "/opt/opencv/usr/local/share/OpenCV")

Usage

#include <kinectfusion.h>

// Define the data source
XtionCamera camera {};

// Get a global configuration (comes with default values) and adjust some parameters
kinectfusion::GlobalConfiguration configuration;
configuration.voxel_scale = 2.f;
configuration.init_depth = 700.f;
configuration.distance_threshold = 10.f;
configuration.angle_threshold = 20.f;

// Create a KinectFusion pipeline with the camera intrinsics and the global configuration
kinectfusion::Pipeline pipeline { camera.get_parameters(), configuration };

// Then, just loop over the incoming frames
while ( !end ) {
    // 1) Grab a frame from the data source
    InputFrame frame = camera.grab_frame();

    // 2) Have the pipeline fuse it into the global volume
    bool success = pipeline.process_frame(frame.depth_map, frame.color_map);
    if (!success)
        std::cout << "Frame could not be processed" << std::endl;
}

// Retrieve camera poses
auto poses = pipeline.get_poses();

// Export surface mesh
auto mesh = pipeline.extract_mesh();
kinectfusion::export_ply("data/mesh.ply", mesh);

// Export pointcloud
auto pointcloud = pipeline.extract_pointcloud();
kinectfusion::export_ply("data/pointcloud.ply", pointcloud);

For a more in-depth example and implementations of the data sources, have a look at the KinectFusionApp.

License

This library is licensed under MIT.

kinectfusionlib's People

Contributors

chrdiller avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.