Giter Site home page Giter Site logo

whigg / point-cloud-registration Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reillybova/point-cloud-registration

0.0 2.0 0.0 22.94 MB

Implements the ICP (Iterative Closest Points) algorithm for registration of point clouds.

License: MIT License

Python 100.00%

point-cloud-registration's Introduction

Point Cloud Registration

This repository contains a Python 3 script that implements the ICP (Iterative Closest Points) algorithm for the 3D registration of point clouds.

Getting Started

Follow these instructions in order to run this script on your local machine (NB: this has only been tested on Mac OSX, but it should work for other systems).

Prerequisites & Installation

This project only requires Python 3 and the NumPy python library. It is suggested that users use pip3 to install NumPy.

Running the Script

This script requires two pairs of files (a total of four files altogether) to run: file1.pts, file1.xf, file2.pts, and file2.xf. When run, the script will attempt to adjust the rigid body transform in file1.xf in order to align the points in file1.pts to the target points, which are the points from file2.pts transformed by the matrix in file2.xf. Finally, the script will output the results in ./output/.

The program is executed as follows:

$ python3 icp.py file1.pts file2.pts

Note that the .xf files are implicit. The program will first look for file.xf in ./output/, and then in the provided file path for the file. This is done to avoid overwriting aligned transformations with the original (inaccurrate) transformation.

Program Explanation

Implementation Details

This program utilizes a custom Python implementation of a KdTree, adapted and expanded from COS 226 assignment code and lectures. Unlike the introductory class assignment, it is a true KdTree in that it is able to handle points of any positive dimension k.

Additionally, this script heavily relies on the matrix manipulation and linear algebra methods provided by the NumPy library.

Iterative Point Cloud Algorithm

During each ICP iteration, 1000 points are sampled at random from the source dataset (file1), and then each sampled point's nearest neighbor from the target dataset (file2) is computed. Then, outlier rejection is applied, and the remaining points are fed into the over-constrained linear system. Once this is solved, a new transformation matrix to apply on the source dataset is computed, and a new iteration cycle begins if significant improvement has been made. Otherwise, the ICP algorithm terminates with a rigid-body transformation matrix that align's the points in the source dataset with those in the target dataset.

Further details on this algorithm may be found here.

Miscellaneous Notes

This program contains fairly robust error handling, however, it has not been rigorously tested for bugs.

Results

Before After
Before alignment After alignment

To view the "before" results, run $ ./pts_view ./bunny/*.pts. To view the "after" results, run $ ./pts_view ./output/*.pts

To generate the aligned bunny yourself, first remove the output folder and then run these commands:

python3 icp.py ./bunny/bun045.pts ./bunny/bun000.pts
python3 icp.py ./bunny/bun090.pts ./bunny/bun045.pts
python3 icp.py ./bunny/bun315.pts ./bunny/bun000.pts
python3 icp.py ./bunny/bun270.pts ./bunny/bun315.pts
python3 icp.py ./bunny/bun180.pts ./bunny/bun270.pts
python3 icp.py ./bunny/chin.pts ./bunny/bun315.pts
python3 icp.py ./bunny/ear_back.pts ./bunny/bun180.pts
python3 icp.py ./bunny/top2.pts ./bunny/bun180.pts
python3 icp.py ./bunny/top3.pts ./bunny/bun000.pts

Authors

See also the list of contributors who participated in this project.

References

[1] Rusinkiewicz, M. Levoy, "Efficient variants of the ICP algorithm", Proc. 3rd Int. Conf. 3D Digital Imaging and Modeling, pp. 145-152, 2001.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Thank you to Professor Szymon Rusinkiewicz for putting this assignment together for the Fall 2018 semester of COS 526: Advanced Computer Graphics

point-cloud-registration's People

Contributors

reillybova avatar

Watchers

 avatar  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.