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 = 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.9.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

simpleicp-2.0.9-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simpleicp-2.0.9.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for simpleicp-2.0.9.tar.gz
Algorithm Hash digest
SHA256 8bc6ecccf889da113c28867ae3d689fdeadf19ab5b05586aa6998d4b51740b68
MD5 b33108f6bc3a848ec77575ba00731854
BLAKE2b-256 11cd0ce5289fe9cb7eef935dfb3c16d7452dcc48abc7a2e8acf8670552159485

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simpleicp-2.0.9-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for simpleicp-2.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 071da140a5a0197b3d9e8821387cf5b7abaf29483d2a6aa38b35a9135cbab2a7
MD5 f0bf7097eebeaa818db1573d1bc05afa
BLAKE2b-256 6aadf004a4911fba1d946baac47dd036a8ffd83f930b15beaf2dacc3a91783f1

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