/kNNcuda

knn Cuda implementation

Primary LanguageCGNU General Public License v3.0GPL-3.0

DEPRECATED

Moved to Las-Vegas-Reconstruction-Toolkit (Surface Reconstruction from PointClouds). Link: https://github.com/uos/lvr2.

Improvements:

  • Bugfixes
  • Improved Cuda implementation
  • OpenCl port

LVR2 builds the executables lvr2_cuda_normals and lvr2_cl_normals which use normal the estimation on GPU in minimal form.

OLD Softwarename: cudaNormals


k - Nearest Neighbor Search on Pointclouds for normal estimation with CUDA.

Requirements:

Abstract

This Toolkit includes a class for normal calculation on big pointclouds. It was researched during the "Parallel computing"-course of the University Osnabrück (Lecturer: Juan Carlos Saborio Morales). The software generates a left-balanced array-based kd-tree on a pointcloud. The k-nearest neighbor search and the normal calculation is computed highly parallel on the GPU with the CUDA-Toolkit.

Workflow

![alt tag](https://github.com/aock/kNNcuda/blob/master/res/workflow_normals_cuda.png)

Normal Calculation with CUDA:

Include calcNormalsCuda.h in your program.

Add your code to the example CMakeLists.txt:

    ##### ADD YOUR CODE HERE #####
    add_executable(your_program path/to/your/code.cpp)
target_link_libraries(your_program
    normalsCuda
)

Header:

include/calcNormalsCuda.h

Parameters in constructor are:

- Pointcloud (as struct "PointArray" defined in calcNormalsCuda.h)

constructs the kd-tree

Set other global parameters with:

- setK(int): set the k of the kNN search. Default: 50 - setFlippoint(float x, float y, float z): set the normal orientation point for flipping. Default: (100000.0, 100000.0, 100000.0). - setMethod(const char* method): set method for normal calculation. "RANSAC"/"PCA". Default: "PCA".

Start normal calculation on GPU

- start()

Get resulting normals

- getNormals(PointArray& normals): mallocs and fills the resulting normal array.

Struct PointArray:

struct PointArray { 
int width;
int dim;
float* elements;
};

Example Code (src/main.cpp)

Reading a File with the Stanford Triangle Format (.ply) to a PointArray

Executing the CUDA normal calculation

Writing PointArray of points and PointArray of normals to destination file