Skip to main content

Simple version of the Iterative Closest Point (ICP) algorithm

Project description

simpleICP

This package contains an implementation of a rather simple version of the Iterative Closest Point (ICP) algorithm.

Documentation

This python implementation is just one of several (almost identical) implementations of the ICP algorithm in various programming languages. They all share a common documentation here: https://github.com/pglira/simpleICP

Installation

You can install the simpleicp package from PyPI:

pip install simpleicp

How to use

from simpleicp import PointCloud, SimpleICP
import numpy as np

# Read point clouds from xyz files into n-by-3 numpy arrays
X_fix = np.genfromtxt("bunny_part1.xyz")
X_mov = np.genfromtxt("bunny_part2.xyz")

# Create point cloud objects
pc_fix = PointCloud(X_fix, columns=["x", "y", "z"])
pc_mov = PointCloud(X_mov, columns=["x", "y", "z"])

# Create simpleICP object, add point clouds, and run algorithm!
icp = SimpleICP()
icp.add_point_clouds(pc_fix, pc_mov)
H, X_mov_transformed, rigid_body_transformation_params, distance_residuals = icp.run(max_overlap_distance=1)

This should give this output:

Consider partial overlap of point clouds ...
Select points for correspondences in fixed point cloud ...
Estimate normals of selected points ...
Start iterations ...
iteration | correspondences | mean(residuals) |  std(residuals)
   orig:0 |             863 |          0.0403 |          0.1825
        1 |             862 |          0.0096 |          0.1113
        2 |             775 |          0.0050 |          0.0553
        3 |             807 |          0.0022 |          0.0407
        4 |             825 |          0.0016 |          0.0346
        5 |             825 |          0.0010 |          0.0253
        6 |             816 |          0.0008 |          0.0198
        7 |             785 |         -0.0000 |          0.0142
        8 |             764 |          0.0008 |          0.0091
        9 |             753 |          0.0003 |          0.0061
       10 |             735 |          0.0002 |          0.0040
       11 |             742 |         -0.0001 |          0.0032
       12 |             747 |         -0.0000 |          0.0030
       13 |             752 |         -0.0000 |          0.0030
       14 |             752 |         -0.0000 |          0.0029
Convergence criteria fulfilled -> stop iteration!
Estimated transformation matrix H:
[    0.984798    -0.173702    -0.000053     0.000676]
[    0.173702     0.984798     0.000084    -0.001150]
[    0.000038    -0.000092     1.000000     0.000113]
[    0.000000     0.000000     0.000000     1.000000]
... which corresponds to the following rigid-body transformation parameters:
parameter |       est.value | est.uncertainty |       obs.value |      obs.weight
   alpha1 |       -0.004804 |        0.004491 |        0.000000 |       0.000e+00
   alpha2 |       -0.003061 |        0.002104 |        0.000000 |       0.000e+00
   alpha3 |       10.003124 |        0.005680 |        0.000000 |       0.000e+00
       tx |        0.000676 |        0.000418 |        0.000000 |       0.000e+00
       ty |       -0.001150 |        0.000885 |        0.000000 |       0.000e+00
       tz |        0.000113 |        0.000189 |        0.000000 |       0.000e+00
(Unit of est.value, est.uncertainty, and obs.value for alpha1/2/3 is degree)
Finished in 4.737 seconds!

Note that bunny_part1.xyz and bunny_part2.xyz are not included in this package. They can be downloaded (among other example files) here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simpleicp-2.0.13.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

simpleicp-2.0.13-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file simpleicp-2.0.13.tar.gz.

File metadata

  • Download URL: simpleicp-2.0.13.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for simpleicp-2.0.13.tar.gz
Algorithm Hash digest
SHA256 e7d76d0cd5113bfb2496dd58e84379a3585686a68d84fb026a190a03617f8a06
MD5 9d8efa2be214427fc4938843bf5a60b8
BLAKE2b-256 5e73dc210d16518f25809af261003fa4b1f4a4b915833aaaa8b102d66607909a

See more details on using hashes here.

File details

Details for the file simpleicp-2.0.13-py3-none-any.whl.

File metadata

  • Download URL: simpleicp-2.0.13-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for simpleicp-2.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 a50ec2ab21edad605ee5c2a3622b53fc4597e96d8e3c7749cd4229961349195a
MD5 2c3cec18845ed85c36ebf09ea2db9195
BLAKE2b-256 0d2cd83f6953224431aeccb594787b866ca3e7b230b2b1fa6c7e8bccfacd15a8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page