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.3.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

simpleicp-2.0.3-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simpleicp-2.0.3.tar.gz
  • Upload date:
  • Size: 13.3 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.3.tar.gz
Algorithm Hash digest
SHA256 2eacc9783ab16c3a427ab77d973c82abb721e54e4e5856853eb03aadf4d8f278
MD5 5bd05cb7d20393ca80628f162c6f70c2
BLAKE2b-256 bded73c9473a4c615c8f305a108ce334b01fb398a88cffb82e7ea89eca744ac1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simpleicp-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f32afc73b9e64a0c17a1e7a01ae70652f3434fb1dfc1706e3ae4f0b040502b19
MD5 e733cadd93eb2eaf4784ee31a21d49db
BLAKE2b-256 cb944e08ff27cfd55ee6fc8368c29c762ab6eb6484c1563ac97061756910bf34

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