Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

pcregisterndt

Register two point clouds using NDT algorithm

Syntax

tform = pcregisterndt(moving,fixed,gridStep)
[tform,movingReg] = pcregisterndt(moving,fixed,gridStep)
[___,rmse] = pcregisterndt(moving,fixed,gridStep)
[___] = pcregisterndt(moving,fixed,gridStep,Name,Value)

Description

example

tform = pcregisterndt(moving,fixed,gridStep) returns the rigid transformation that registers the moving point cloud with the fixed point cloud. The point clouds are voxelized into cubes of size gridStep.

The registration algorithm is based on the normal-distributions transform (NDT) algorithm [1] [2]. Best performance of this iterative process requires adjusting properties for your data. To improve accuracy and efficiency of registration, consider downsampling the point clouds by using pcdownsample before using pcregisterndt.

[tform,movingReg] = pcregisterndt(moving,fixed,gridStep) also returns the transformed point cloud that aligns with the fixed point cloud.

[___,rmse] = pcregisterndt(moving,fixed,gridStep) also returns the root mean square error of the Euclidean distance between the aligned point clouds, using any of the preceding syntaxes.

[___] = pcregisterndt(moving,fixed,gridStep,Name,Value) uses additional options specified by one or more Name,Value pair arguments.

Examples

collapse all

Load point cloud data.

ld = load('livingRoom.mat');
moving = ld.livingRoomData{1};
fixed = ld.livingRoomData{2};
pcshowpair(moving,fixed,'VerticalAxis','Y','VerticalAxisDir','Down')

To improve the efficiency and accuracy of the NDT registration algorithm, downsample the moving point cloud.

movingDownsampled = pcdownsample(moving,'gridAverage',0.1);

Voxelize the point cloud into cubes of sidelength 0.5. Apply the rigid registration using the NDT algorithm.

gridStep = 0.5;
tform = pcregisterndt(movingDownsampled,fixed,gridStep);

Visualize the alignment.

movingReg = pctransform(moving,tform);
pcshowpair(movingReg,fixed,'VerticalAxis','Y','VerticalAxisDir','Down')

Input Arguments

collapse all

Moving point cloud, specified as a pointCloud object.

Fixed point cloud, specified as a pointCloud object.

Size of the 3-D cube that voxelizes the fixed point cloud, specified as a positive scalar.

Data Types: single | double

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'MaxIterations',20 stops the NDT algorithm after 20 iterations.

collapse all

Initial rigid transformation, specified as the comma-separated pair consisting of 'InitialTransform' and an affine3d object. The initial rigid transformation is useful when you provide an external coarse estimation.

Expected percentage of outliers with respect to a normal distribution, specified as the comma-separated pair consisting of 'OutlierRatio' and a scalar in the range [0, 1). The NDT algorithm assumes a point is generated by a mixture of a normal distribution for inliers and a uniform distribution for outliers. A larger value of 'OutlierRatio' reduces the influence of outliers.

Data Types: single | double

Maximum number of iterations before NDT stops, specified as the comma-separated pair consisting of 'MaxIterations' and a nonnegative integer.

Data Types: single | double

Tolerance between consecutive NDT iterations, specified as the comma-separated pair consisting of 'Tolerance' and a 2-element vector with nonnegative values. The vector, [Tdiff Rdiff], represents the tolerance of absolute difference in translation and rotation estimated in consecutive NDT iterations. Tdiff measures the Euclidean distance between two translation vectors. Rdiff measures the angular difference in degrees. The algorithm stops when the difference between estimated rigid transformations in the most recent consecutive iterations falls below the specified tolerance value.

Data Types: single | double

Display progress information, specified as the comma-separated pair consisting of 'Verbose' and a logical scalar. Set Verbose to true to display progress information.

Data Types: logical

Output Arguments

collapse all

Rigid transformation, returned as an affine3d object. tform describes the rigid 3-D transformation that registers the moving point cloud, moving, to the fixed point cloud, fixed.

Transformed point cloud, returned as a pointCloud object. The transformed point cloud is aligned with the fixed point cloud, fixed.

Root mean square error, returned as a positive number. rmse is the Euclidean distance between the aligned point clouds.

Algorithms

References

[1] Biber, P., and W. Straßer. “The Normal Distributions Transform: A New Approach to Laser Scan Matching.” Proceedings of IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). Las Vegas, NV. Vol. 3, November 2003, pp. 2743–2748.

[2] Magnusson, M. “The Three-Dimensional Normal-Distributions Transform — an Efficient Representation for Registration, Surface Analysis, and Loop Detection.” Ph.D. Thesis. Örebro University, Örebro, Sweden, 2013.

Introduced in R2018a