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 = 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 |             951 |          0.0401 |          0.2397
        1 |             950 |          0.0027 |          0.1356
        2 |             889 |          0.0026 |          0.0586
        3 |             897 |          0.0020 |          0.0407
        4 |             873 |          0.0004 |          0.0303
        5 |             854 |          0.0004 |          0.0245
        6 |             847 |          0.0003 |          0.0208
        7 |             826 |         -0.0006 |          0.0154
        8 |             799 |          0.0005 |          0.0099
        9 |             787 |          0.0002 |          0.0068
       10 |             783 |         -0.0001 |          0.0047
       11 |             779 |         -0.0001 |          0.0037
       12 |             776 |         -0.0000 |          0.0033
       13 |             776 |         -0.0000 |          0.0033
Convergence criteria fulfilled -> stop iteration!
Estimated transformation matrix H:
[    0.984804    -0.173671    -0.000041     0.000420]
[    0.173671     0.984804     0.000051    -0.000750]
[    0.000032    -0.000057     1.000000     0.000054]
[    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.002906 |        0.004963 |        0.000000 |        0.000000
   alpha2 |       -0.002353 |        0.002339 |        0.000000 |        0.000000
   alpha3 |       10.001317 |        0.006276 |        0.000000 |        0.000000
       tx |        0.000420 |        0.000459 |        0.000000 |        0.000000
       ty |       -0.000750 |        0.000974 |        0.000000 |        0.000000
       tz |        0.000054 |        0.000209 |        0.000000 |        0.000000
(Unit of est.value, est.uncertainty, and obs.value for alpha1/2/3 is degree)
Finished in 4.320 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.1.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

simpleicp-2.0.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simpleicp-2.0.1.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for simpleicp-2.0.1.tar.gz
Algorithm Hash digest
SHA256 5afba78489ec0484f8106509b7c911d8d065fd2d6f3764955fa74a32bd8ac1da
MD5 977d7c3a7477dadaf567a5791c005d1f
BLAKE2b-256 d09896d0479cfb3e87ff62103c82e0fff2464f44dfb2e1b6f0f8c39a203d23f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simpleicp-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for simpleicp-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82bb6f82812e2c06763a4412d31de3eadcc89d149ba73807487d9ffa3d74aa42
MD5 515d2d5454b07abd4131278543187648
BLAKE2b-256 9164996f2dc2eefea32476ae24ab890a65fb533241af64f24fada57993857cc0

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