Main Content

pcregistercorr

Register two point clouds using phase correlation

Description

example

tform= pcregistercorr(moving,fixed,gridSize,gridStep)computes the rigid transformation that registers the moving point cloud,moving, to the fixed point cloud,fixedusing a phase correlation algorithm.

The function performs registration by first converting both point clouds to a 2-D occupancy grid in theX-Yplane with center at the origin (0,0,0). The occupancy of each grid cell is determined using theZ-coordinate values of points within the grid.

[tform,rmse] = pcregistercorr(___)additionally returns the root mean square error of the Euclidean distance between the registered point clouds.

[___,peak] = pcregistercorr(___)additionally returns the peak correlation value of the phase difference between the two occupancy grids.

[___] = pcregistercorr(___,Name=Value)specifies options using one or more name-value arguments in addition to any combination of arguments from previous syntaxes. For example,Window=falsesets theWindowname-value argument tofalseto suppress using windowing .

Examples

collapse all

Read data from a Velodyne packet capture (PCAP) file into the workspace.

veloReader = velodyneFileReader('lidarData_ConstructionRoad.pcap','HDL32E');

Read a fixed and a moving point cloud from frames of the lidar data.

frameNumber = 1; skipFrame = 5; fixed = readFrame(veloReader,frameNumber); moving = readFrame(veloReader,frameNumber + skipFrame);

Find the ground planes for both the moving and the fixed point clouds. Set the maximum distance in meters.

maxDistance = 0.4;referenceVector = (0 0 1);组织ndMoving = pcfitplane(moving,maxDistance,referenceVector); groundFixed = pcfitplane(fixed,maxDistance,referenceVector);

Transform the point clouds so that their ground planes are parallel to theX-Yplane.

tformMoving = normalRotation(groundMoving,referenceVector); tformFixed = normalRotation(groundFixed,referenceVector); movingCorrected = pctransform(moving,tformMoving); fixedCorrected = pctransform(fixed,tformFixed);

Register the moving point cloud against the fixed point cloud. Set the occupancy grid size to 100-by-100 meters and the size of each grid cell to 0.5-by-0.5 meters.

gridSize = 100; gridStep = 0.5; tform = pcregistercorr(movingCorrected,fixedCorrected,gridSize,gridStep);

Transform the moving point cloud using an estimated rigid transformation.

combinedTform = rigid3d(tform.T * tformMoving.T * tformFixed.T); movingReg = pctransform(moving,combinedTform);

Visualize the registration.

figure subplot(121) pcshowpair(moving,fixed) title('Before Registration') view(2) subplot(122) pcshowpair(movingReg,fixed) title('After Registration') view(2)

Input Arguments

collapse all

Moving point cloud, specified as apointCloudobject.

Fixed point cloud, specified as apointCloudobject.

Size of square occupancy grid, specified as a scalar value in world units. The occupancy grid has both width and height equal to this value. The center is at the origin (0, 0, 0).

Size of each grid cell, specified as a scalar value in world units.

Name-Value Arguments

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, whereNameis the argument name andValueis the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and encloseNamein quotes.

Example:zlim=[0 3]sets theZ-axis lower limit to0and the upper limit to3.

Z-axis limit to compute the occupancy of a grid cell, specified as a vector of the form [zminzmax], wherezminandzmaxare numeric scalars. The function scales points with aZ-axis value fromzmintozmaxto probabilities in the range [0, 1]. Values less thanzminare assigned an occupancy value of0. Values greater thanzmaxare assigned an occupancy value of1.

Logical to use windowing to suppress spectral leakage effects in the frequency domain, specified as a numeric or logical0(false) or1(true). When you setWindowtotrue, the function uses a Blackman window to increase the stability of registration results. If the common features that will be aligned in the occupancy grids are oriented along the edges, then settingWindowtofalsecould provide superior registration results.

Output Arguments

collapse all

Rigid transformation, returned as arigid3dobject. The rigid transformation registers a moving point cloud to a fixed point cloud. Therigid3dobject describes the rigid 3-D transform.

Root mean square error, returned as the Euclidean distance between the aligned point cloud. A lowrmsevalue indicates a more accurate registration.

Peak correlation value of the phase difference between the two occupancy grids, returned as a scalar value. A peak value less than0.03indicates a poor registration result.

Tips

  • The phase correlation method is best used to register point clouds when the transformation can be described by a translation in theX-Yplane and a rotation around theZ-axis. For example, a ground vehicle with a horizontally mounted lidar moving on a flat surface.

  • The phase correlation algorithm expects motion to be exclusively along theX-Yplane, as with the ground plane. If motion is not exactly in theX-Yplane, you can use thenormalRotationfunction to transform the point clouds. For example, in vehicular motion, you can reduce the effects of vehicle suspension or surface features such as potholes and speed bumps by using thenormalRotationfunction.

  • Increasing the size of the occupancy grid increases the computational demands of this function. You can control the size of the occupancy grid by modifying thegridSizeandgridSteparguments.

  • If you obtain poor registration results and thepeakcorrelation value is less than0.03, try setting theWindowargument tofalse.

References

[1] Dimitrievski, Martin, David Van Hamme, Peter Veelaert, and Wilfried Philips. “Robust Matching of Occupancy Maps for Odometry in Autonomous Vehicles.” InProceedings of the 11th Joint Conference on Computer Vision, Imaging and Computer Graphics Theory and Applications, 626–33. Rome, Italy: SCITEPRESS - Science and Technology Publications, 2016.

Version History

Introduced in R2020b