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.

pcregistercpd

Register two point clouds using CPD algorithm

Syntax

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

Description

example

tform = pcregistercpd(moving,fixed) returns a transformation that registers a moving point cloud with a fixed point cloud using the coherent point drift (CPD) algorithm [1].

Note

Consider downsampling point clouds using pcdownsample before using pcregistercpd to improve the efficiency of registration.

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

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

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

Examples

collapse all

Load point cloud data into the workspace. Extract the moving and the fixed point clouds from the point cloud data in workspace.

handData = load('hand3d.mat');
moving = handData.moving;
fixed = handData.fixed;

To improve the efficiency and accuracy of the CPD registration algorithm, downsample the moving and the fixed point clouds.

movingDownsampled = pcdownsample(moving,'gridAverage',0.03);
fixedDownsampled = pcdownsample(fixed,'gridAverage',0.03);

Display the downsampled point clouds before registration.

figure
pcshowpair(movingDownsampled,fixedDownsampled,'MarkerSize',50)
xlabel('X')
xlabel('Y')
zlabel('Z')
title('Point clouds before registration')
legend('Moving point cloud','Fixed point cloud')
legend('Location','southoutside')

Perform non-rigid registration using the CPD algorithm.

tform = pcregistercpd(movingDownsampled,fixedDownsampled);
movingReg = pctransform(movingDownsampled,tform);

Display the downsampled point clouds after registration.

figure
pcshowpair(movingReg,fixedDownsampled,'MarkerSize',50)
xlabel('X')
xlabel('Y')
zlabel('Z')
title('Point clouds after registration')
legend('Moving point cloud','Fixed point cloud')
legend('Location','southoutside')

Input Arguments

collapse all

Moving point cloud, specified as a pointCloud object.

Fixed point cloud, specified as a pointCloud object.

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 quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

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

Type of transformation, specified as the comma-separated pair consisting of 'Transform' and the 'Nonrigid', 'Rigid', or 'Affine' character vectors or string scalars.

Data Types: char | string

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). Increasing this value reduces the influence of outliers and noise.

Data Types: single | double

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

Data Types: single | double

Tolerance between consecutive CPD iterations, specified as the comma-separated pair consisting of 'Tolerance' and a scalar. The algorithm stops when absolute percentage change in the values of the log likelihood function measured between consecutive iterations reaches or falls below the specified tolerance value. Decreasing this value increases the likelihood of a better alignment.

Data Types: single | double

Interaction between points, specified as the comma-separated pair consisting of 'InteractionSigma' and a positive scalar that represents standard deviation of a Gaussian filter. Typical values are in the range [1.5,3]. Increasing this value increases interaction between the points in point cloud. As a result, you can observe coherent motion in the point cloud and every point undergoes the same displacement. Alternatively, decreasing this value reduces interaction between the points in point cloud. As a result, you can observe localized displacement of points and the output displacement field exhibits localized deformation.

Note

To use this name-value pair, 'Transform' must be 'Nonrigid'.

Data Types: single | double

Motion smoothing weight, specified as the comma-separated pair consisting of 'SmoothingWeight' and a positive scalar. Typical values are in the range [0.1,10]. Increase this value to produce a more coherent motion in the output displacement field.

Note

To use this name-value pair, 'Transform' must be 'Nonrigid'.

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

Note

Both 'MaxIterations' and 'Tolerance' are used as stopping criteria. The algorithm stops when it satisfies either of the stopping conditions, i.e., when the number of iteration reaches MaxIterations or the absolute percentage change in log likelihood function is less than or equal to Tolerance.

Output Arguments

collapse all

Transformation, returned as an affine3d object or a displacement field. tform is the 3-D transformation that registers the moving point cloud, moving to the fixed point cloud, fixed. When 'Transform' is 'Nonrigid', pcregistercpd returns a displacement field. The returned displacement field is a numeric matrix of same size and datatype as the Location property of moving point cloud object, moving.

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 real number. rmse is the Euclidean distance between the aligned point clouds.

Data Types: double

References

[1] Myronenko, A., and X. Song. "Point Set Registration: Coherent Point Drift. "Proceedings of IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI). Vol 32, Number 12, December 2010, pp. 2262–2275.

Extended Capabilities

Introduced in R2018b