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

Uploaded Source

Built Distribution

simpleicp-2.0.8-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simpleicp-2.0.8.tar.gz
  • Upload date:
  • Size: 14.1 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.8.tar.gz
Algorithm Hash digest
SHA256 2e1d0d975389ea1c3dae84d5bb2c67f7012cf7acc7f411fe2d484f675687f5db
MD5 3ca71474491b50884e5dc503a3d4621f
BLAKE2b-256 cf7ada5ccc752e26e1cee8e568a79926996d1d45f421c2afa108fd4595c7a86e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simpleicp-2.0.8-py3-none-any.whl
  • Upload date:
  • Size: 15.3 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0c53fd2d9d623aac0cc4971a3810083ee92a18dcbbca441b0030d576f41da45a
MD5 0c53f58d101a9cc7276134bb8a25ef79
BLAKE2b-256 84d721e61bdc470ccdbf976def00d2302085894e2b9a455bc1bd957367017b03

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