Main Content

pcregisterloam

Register two point clouds using LOAM algorithm

Description

example

tform= pcregisterloam(movingPtCloud,fixedPtCloud,gridStep)registers the moving point cloudmovingPointswith the fixed point cloudfixedPointsusing the lidar odometry and mapping (LOAM) algorithm. The function returns the rigid transformationtform, between the moving and fixed point clouds.gridStepspecifies the size of a 3-D box used to downsample the LOAM points detected in the input point clouds.

tform= pcregisterloam(movingPoints,fixedPoints)registers the moving LOAM pointsmovingPointswith the fixed LOAM pointsfixedPointsand returns the rigid transformation between themtform。Using this function to register LOAM points is faster and more accurate than using it to register point clouds.

您可以使用detectLOAMFeaturesfunction, which detects LOAM feature points from organized point clouds.

[tform,RMSE] = pcregisterloam(___)returns the root mean squared errorRMSEof the Euclidean distance between the aligned points.

[___] = pcregisterloam(___,Name=Value)specifies options using one or more name-value arguments in addition to any combination of arguments from previous syntaxes. For example,MatchingMethod='one-to-one'sets the matching method algorithm to'one-to-one'

Examples

collapse all

Load and visualize point cloud data.

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

Register the point clouds.

gridStep = 0.5; tform = pcregisterloam(movingPtCloud,fixedPtCloud,gridStep);

Align and visualize the point clouds.

alignedPtCloud = pctransform(movingPtCloud, tform); figure pcshowpair(alignedPtCloud,fixedPtCloud,'VerticalAxis','Y','VerticalAxisDir','Down')

Read point cloud data from a Velodyne PCAP file into the workspace.

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

Read the first point cloud from the data. Use this point cloud as the fixed point cloud.

fixedPtCloud = readFrame(veloReader,1);

Detect LOAM feature points in the fixed point cloud.

fixedPoints = detectLOAMFeatures(fixedPtCloud);

Downsample the less planar surface points from the fixed point cloud, to improve registration speed.

gridStep = 1; fixedPoints = downsampleLessPlanar(fixedPoints,gridStep);

Read and detect LOAM feature points from the fifth point cloud in the data. Use this point cloud as the moving point cloud.

movingPtCloud = readFrame(veloReader,5); movingPoints = detectLOAMFeatures(movingPtCloud);

Downsample the less planar surface points from the moving point cloud.

movingPoints = downsampleLessPlanar(movingPoints,gridStep);

Register the moving point cloud to the fixed point cloud.

tform = pcregisterloam(movingPoints,fixedPoints);

Transform the moving point cloud to align it to the fixed point cloud.

alignedPtCloud = pctransform(movingPtCloud,tform);

Visualize the aligned point clouds. Points from the fixed point cloud display as green, while points from the moving point cloud display as magenta.

figure pcshowpair(alignedPtCloud,fixedPtCloud)

Figure contains an axes object. The axes object contains 2 objects of type scatter.

Input Arguments

collapse all

Organized moving point cloud, specified as apointCloudobject. The point cloud object must contain an organized point cloud with aLocationproperty of sizeM-by-N-by-3 matrix, whereMis the number of laser scans andNis the number of points per scan. The first page represents thex-coordinates, the second page represents they-coordinates, and the third page represents thez- coordinates for each point.

Organized fixed point cloud, specified as apointCloudobject. The point cloud object must contain an organized point cloud with aLocationproperty of sizeM-by-N-by-3 matrix, whereMis the number of laser scans andNis the number of points per scan. The first page represents thex-coordinates, the second page represents they-coordinates, and the third page represents thez- coordinates for each point.

Moving LOAM points, specified as aLOAMPointsobject. You can obtain the LOAM points from the moving point cloud by using thedetectLOAMFeaturesfunction, which detects LOAM feature points from organized point clouds.

Fixed LOAM points, specified as aLOAMPointsobject. You can obtain the LOAM points from the fixed point cloud by using thedetectLOAMFeaturesfunction, which detects LOAM feature points from organized point clouds.

Size of the 3-D box for downsampling the detected LOAM points in the input point cloud, specified as a positive scalar.

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.

Example:pcregisterloam(movingPoints,fixedPoints,MatchingMethod='one-to-one')sets the registration matching method to'one-to-one'

Initial rigid transformation, specified as arigid3dobject. Set the initial transformation to a coarse estimate. If you do not provide a course or initial estimate, the function uses arigid3dobject that contains a translation that moves the center of the moving points to the center of the fixed points.

匹配方法, specified as'one-to-one'or'one-to-many'

  • 'one-to-one'— The algorithm selects the nearest neighbor as a match.

  • 'one-to-many'— The algorithm selects multiple nearest neighbors within the specified search radius as matches. Using the'one-to-many'method can increase registration accuracy, but at the cost of processing speed.

Search radius for point matching, specified as a positive integer. When matching, the function finds the closest edge and surface points within the specified radius. For best results, set this value based on the certainty of theInitialTransform。Increase the value of theSearchRadiuswhen there is greater uncertainty in the initial transformation, but this can also decrease the registration speed.

Maximum iterations before LOAM registration stops, specified as a positive integer.

连续的壤土迭代之间的公差,指定为具有非负值的两元素矢量。向量,[TdiffRdiff].

  • Tdiff— Tolerance for the estimated absolute difference in translation and rotation estimated in consecutive LOAM iterations. Measures the Euclidean distance between two translation vectors.

  • Rdiff— Tolerance for the estimated absolute difference of the angular rotation between consecutive iterations, measured in degrees.

The algorithm stops when the difference between the estimates of the rigid transformations in the most recent consecutive iterations falls below the specified tolerance value.

显示进度信息,指定为一个号码ic or logical0(false) or1(true). To display progress information, setVerbosetotrue

Output Arguments

collapse all

Rigid 3-D transformation, returned as arigid3dobject.tformdescribes the rigid 3-D transformation that registers the moving points to the fixed points.

Root mean squared error, returned as a positive scalar that represents the Euclidean distance between aligned points. A lowerRMSE值表示更准确的注册。

参考

[1] Zhang, Ji, and Sanjiv Singh. “LOAM: Lidar Odometry and Mapping in Real-Time.” In机器人:科学和体制ms X。机器人:科学和体制ms Foundation, 2014. https://doi.org/10.15607/RSS.2014.X.007.

Version History

Introduced in R2022a