Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

### Highlights from Iterative Closest Point Method

Join the 15-year community celebration.

Play games and win prizes!

4.40909
4.4 | 24 ratings Rate this file 93 Downloads (last 30 days) File Size: 11.1 KB File ID: #12627 Version: 1.5

# Iterative Closest Point Method

### Per Bergström (view profile)

13 Oct 2006 (Updated )

Fits points in data to the points in model under a rigid body transformation

File Information
Description

The ICP (iterative closest point) method finds a rigid body transformation such that the points in data fit to the points in model under the transformation. Default is to use least squares minimization but optional other criterion functions can be used as well. The implementation is based on the IRLS-ICP described in
Bergström, P. and Edlund, O. 2014, 'Robust registration of point sets using iteratively reweighted least squares', Computational Optimization and Applications, vol 58, no. 3, pp. 543-561., 10.1007/s10589-014-9643-2

A demonstration where an ICP-algorithm is used in Matlab can be seen on YouTube,

https://youtu.be/lm7_mwpOk0E

MATLAB release MATLAB 8.5 (R2015a)
MATLAB Search Path
`/`
Tags for This File   Please login to tag files.
 Please login to add a comment or rating.
Comments and Ratings (40)
22 Mar 2016 Serge

### Serge (view profile)

HELP

??? Undefined function or method 'nearestNeighbor' for input arguments of type
'double'.

Error in ==> icp at 188
[vi,resid] = nearestNeighbor(DT,data');

Comment only
15 Mar 2016 Baichuan Jiang

### Baichuan Jiang (view profile)

11 Sep 2015 Leonardo Paiva

### Leonardo Paiva (view profile)

Hi,I'm very interested in your algorithm，but i cannot understand it very well,can you give me more describing about this algorithm?
leonardopaiva@deg.ufla.br
Thanks.

Comment only
25 Jun 2015 jianqi shi

### jianqi shi (view profile)

Hi, I'm very interested in your ICP code. Is there any paper or documentation describing this algorithm? In this way I can understand how it works.
Thank you very much!
My email is:shijianqi1991@163.com

25 Jun 2015 Amelia Taylor

### Amelia Taylor (view profile)

Per,

I'm trying to use your program in Octave because I don't currently have access to Matlab. I've nearly got it sorted out, but I'm not 100% sure what the nearNeighbor command is being used for. I am guessing it is interpolation using nearest neighbor methods. If not, please let me know.

Thanks,
Amelia

Comment only
04 May 2015 Hesham Eraqi

### Hesham Eraqi (view profile)

17 Apr 2015 Zeng Zhen

### Zeng Zhen (view profile)

17 Apr 2015 Zeng Zhen

### Zeng Zhen (view profile)

Data points containing Inf or NaN are not
supported.
how to solve this warning?
changing all NaNs to zeros?

18 Nov 2014 Jonathan Dentch

### Jonathan Dentch (view profile)

Zhang,

This method works with 2D points, not 3D.

Comment only
24 Jul 2014 Jonathan Dentch

### Jonathan Dentch (view profile)

I am getting errors while using icp.m.

Error using qhullmx
The data is degenerate in at least one dimension - ND set of points lying in (N+1)D space.

Error in delaunayn (line 101)
t = qhullmx(x', 'd ', opt);

Error in icp>icp_struct (line 416)
Tes=delaunayn(MODEL');

Error in icp (line 318)
tes_flag=icp_struct(tes_flag); % construct a Delaunay tesselation and two vectors make it easy
to find in Tes

Error in test_2 (line 4)
[R, T] = icp(points1, points2);

points1.txt

0. 0. 0.
1. 0. 0.
2. 0. 0.
3. 0. 0.
0. 1. 0.
1. 1. 0.
2. 1. 0.
3. 1. 0.
0. 2. 0.
1. 2. 0.
2. 2. 0.
3. 2. 0.
0. 3. 0.
1. 3. 0.
2. 3. 0.
3. 3. 0.

points2.txt

1. 2. 3.
2. 2. 3.
3. 2. 3.
4. 2. 3.
1. 3. 3.
2. 3. 3.
3. 3. 3.
4. 3. 3.
1. 4. 3.
2. 4. 3.
3. 4. 3.
4. 4. 3.
1. 5. 3.
2. 5. 3.
3. 5. 3.
4. 5. 3.

test_2.m

clear;
points1 = dlmread('points1.txt', ' ');
points2 = dlmread('points2.txt', ' ');
[R, T] = icp(points1, points2);

Please advise.

Comment only
26 Mar 2014 south

### south (view profile)

Your ICP is EXCELLENT!Thank you very much !

14 Nov 2013 chang lele

### chang lele (view profile)

12 Nov 2013 Vicamce

### Vicamce (view profile)

Hi,Your ICP is very well. In this moment I'm working the icp algorithm.I'm very interested in it.Is there any paper discribing your algorithm? Thank you. My email is vicamce@yahoo.com

Comment only
15 Oct 2013 zhongling Ma

### zhongling Ma (view profile)

Hi,I'm studying the icp algorithm.I'm very interested in it.Is there any paper discribing your algorithm?Could you tell me,thank you very much.My email is :452687156@qq.com

18 Sep 2013 Marina Marina

### Marina Marina (view profile)

Hi, your ICP code works very well. Is there any paper or documentation describing this algorithm? In this way I can understand how it works.
Thanks.
xxmariinsxx@hotmail.com

Comment only
08 Jun 2013 Cheng Zhang

### Cheng Zhang (view profile)

Hi,I'm very interested in your algorithm. Is there any paper discribing your algorithm?Could you tell me,thank you very much .my email is :mjcheng@mail.ustc.edu.cn

06 May 2013 jack chem

### jack chem (view profile)

Hi,I'm very interested in your algorithm，but i cannot understand it very well,can you give me more describing about about this algorithm? we0704csu@163.com
Thanks.

08 Dec 2012 change

### change (view profile)

your icp scrip is very good. i could use it very often. But is there any paper discribing your algorithm? I´m interested in its details to understand the operations it does. How does it work?
john1529w@hotmail.com
Thanks

Comment only
17 Nov 2012 Ranger

### Ranger (view profile)

Hi Mr. Bergström,
your icp scrip is very good. i could use ist very often. But is there any paper discribing your algorithm? I´m interested in its details to understand the operations it does. How does it work?
robertkamolz@googlemail.com
Thanks

21 Apr 2012 leila hell

### leila hell (view profile)

hello, i would like to know what are the hypothesys for using the ICP and around which axes the rotation R is made ?

Comment only
14 Jan 2012 Mithun

### Mithun (view profile)

Can you please explain how the err function is working in this?

Comment only
04 Dec 2011 Yuan Billy

### Yuan Billy (view profile)

04 Oct 2011 Daniel

### Daniel (view profile)

Is there any literature describing this particular algorithm? Is it based on Besl and McKay (1992), or is this a different implementation?
cook348@gmail.com
Thanks.

Comment only
03 Jul 2011 Thai Nguyen

### Thai Nguyen (view profile)

Dear Per,
I have run your source codes in Visual C++ 2008 and use the the same data and model for testing in C++, but the results from C++ are different in comparison with from icp_demo.m. When I re-calculate the new data by applying the rotation matrix and translation vector which I have obtained from C++, the plotting of new-data and model points are not match. Could you tell me what reasons? (P/S: my email is svcorp110@gmail.com, if possible please directly send your answers via my email). Thank you very much!
Best regards,
Nguyen Van Thai
AOI Lab

Comment only
31 May 2011 Lu Jin

### Lu Jin (view profile)

cp_struct(tes_flag); % construct a Delaunay tesselation and two vectors make it easy to find in Tes

15 Apr 2011 Petter

### Petter (view profile)

05 Apr 2011 Huang Chun-Hsiang

### Huang Chun-Hsiang (view profile)

Good code !! Thank you.

05 Apr 2011 Huang Chun-Hsiang

### Huang Chun-Hsiang (view profile)

15 Mar 2011 Yuksel

### Yuksel (view profile)

I run the program for 3D data. I used 'model' and 'data' with different sizes and it worked. However, there are about 1-1.5 m differences in z values after gridding the data sets. I also would like to know what is the reference for the program. Thank you.

18 Mar 2010 Dimitrios Skarlatos

### Dimitrios Skarlatos (view profile)

Hi.
Does the code works for full 3D objects or only in 2.5D ?
By 2.5D i mean surfaces that can only handle one Z value for every X,Y
Thanks

Comment only
04 Mar 2010 Brian Chuang

### Brian Chuang (view profile)

Hi, Thanks for this code

One quick question:

Should the new fitted points be
newdata = R*data - T instead of +T as commented in the code?

02 Nov 2009 asadi

### asadi (view profile)

Hi I can't download icp.rar from this page. can anyone send it for me ?
Thanks alot
atefe.asadi@yahoo.com

Comment only
15 Jan 2008 Jurandir Junior
04 Nov 2007 Louis Tang

This programe is quite good. It's the implementation of the original ICP algorithm. the only deficiency is that it only supports input model and data point set with the same dimension.

02 Oct 2007 Syed Islam
18 Jun 2007 ray dury

ICP algo give good results only if we are near a good matching.

You may prefer other methods to approach the solution.

Before than use ICP algo.

There are stochastic ICP that solve this problem.

This code is good, use it without risk

22 Feb 2007 erol seke

Did not handle scaling. Fails with large rotations and/or translations. Otherwise ok.
Note: I tested only with 2D data.

05 Jan 2007 J. Lincoln Carpenter

There could be more comments, especially for some of the alternate input arguements. But on the whole it's a well written and useful m-file for optimization and image registration.

18 Nov 2006 Tahir Yaqub

The error message is quite long but the last line is mentioend in my previous message and first is this:
??? qhull precision error: initial facet 1 is coplanar with the interior point
ERRONEOUS FACET:

While executing: | qhull d Qt Qbb Qc

Comment only
18 Nov 2006 Tahir Yaqub

Hi Bergstorm
When i run the program, following error comes:
Error in ==> icp at 275
icp_struct(tes_flag); % construct a Delaunay tesselation and two vectors make it easy to find in Tes

Comment only
Updates
17 Oct 2006

Have added a choice to use an other seach method, tes_flag=2 (see help icp).

08 Nov 2006

Added weighted sum of squares minimization.

21 Nov 2006

ICP can now handle point clouds whos principal components do not span the whole space.

16 Jan 2007

Have added a new choice for tesselaton structure.

18 Jan 2007

Have done the last update complete.

08 Mar 2007

Have done some small changes!

16 Jun 2015 1.5

A new implementation of the ICP algorithm and three examples are added

Contact us