Get Started with the Lidar Registration Analyzer App
The Lidar Registration Analyzer app enables you to interactively register point clouds and compare the results of using different registration techniques. The app enables you to quickly upload point cloud data, register the point clouds, and visualize their alignment. You can optionally include preprocessing steps to optimize the speed and accuracy of the registration.
These sections describe how to use the app to interactively tune registration and preprocessing parameters, and how to export the data. Registration using the app typically includes these steps:
Features of the Lidar Registration Analyzer App
The Lidar Registration Analyzer app provides these interactive features.
Analyzer — Use the toolstrip to import point clouds, select registration techniques, and select preprocessing steps. You can also start point cloud registration, restore the default layout, and export the registration results.
Point Cloud Information — Displays color-coded information about the moving and fixed point clouds displayed in the center pane.
Registration Parameters — Tune the parameters of your selected registration technique.
Preprocessing — Tune the parameters of your selected preprocessing steps.
Registration Trials — History of attempted registrations. This pane lists each registration with a unique ID and the registration technique used. Once you perform registration, this pane also displays the RMSE and runtime values for each registration trial
If you modify a registration or preprocessing parameter (for registration or preprocessing) of a completed registration, the app creates a new trial and updates the Registration Trials pane with a corresponding new entry. To visualize the effect of the tuned parameter on the alignment, you must reregister the point clouds.
Import Point Clouds
You can import organized and unorganized point clouds from PCD or PLY files, or
directly from the MATLAB® workspace. For more information on the differences between organized and
unorganized point clouds, see What are Organized and Unorganized Point Clouds? To import point
clouds from a PCD or PLY file, on the app toolstrip, select Import Point
Clouds and then From File. In the
Import Point Clouds dialog, use the Moving Point
Cloud and Fixed Point Cloud fields to select the
files to import them. You can also import a point cloud of any format from the
MATLAB workspace, but you must first add it to the workspace as a 1-by-1 pointCloud
object. For example, this code shows you how to load Velodyne
point cloud data from a PCAP file into the MATLAB workspace using the velodyneFileReader
function.
veloReader = velodyneFileReader("lidarData_ConstructionRoad.pcap","HDL32E"); fixedPtCloud = readFrame(veloReader,1); movingPtCloud = readFrame(veloReader,5);
Select a Registration Technique and Evaluate Results
The Lidar Registration Analyzer app offers various registration techniques for aligning point clouds. These are the techniques you can choose from in the app.
Iterative closest point (ICP) — Iteratively aligns two point clouds by minimizing the point-to-point, point-to-plane, or plane-to-plane distance between the corresponding points of the point clouds.
Normal distributions transform (NDT) — Utilizes normal distributions in each voxel to find the transformation that best aligns the point clouds.
Lidar odometry and mapping (LOAM) — Feature-based approach to align two point clouds that detects and matches edge and surface points between the point clouds, and then minimizes the distance between the matched points.
Fast global registration (FGR) — Feature-based approach based on fast point feature histogram (FPFH) features.
Phase correlation — Recommended for ground vehicles with a horizontally mounted lidar sensor moving on a flat surface in which you can describe the transformation as a translation in the X-Y plane and a rotation around the Z-axis.
Coherent point drift (CPD) — Computationally intensive technique recommended for small point clouds, of roughly 10,000 points or less.
You can classify registration techniques as local or global. Local registration techniques provide greater accuracy by fine-tuning the alignment. They work best when an initial transformation is available, or when the point clouds are roughly aligned initially. Consider using global registration techniques when you do not have an initial transformation available, or when the initial misalignment is significant.
This table summarizes key aspects for each of the registration techniques, and denotes whether the resulting MATLAB API has C/C++ or GPU code generation support.
Technique | Registration Type | Iterative | Supports Unorganized Point Clouds | Relies on Initial Transformation | Feature-based | C/C++ Code Generation | GPU Code Generation |
---|---|---|---|---|---|---|---|
ICP | Local | ✓ | ✓ | ✓ | X | ✓ | ✓ |
NDT | ✓ | ✓ | ✓ | X | ✓ | ✓ | |
LOAM | ✓ | X | ✓ | ✓ | ✓ | ✓ | |
FGR | Global | ✓ | ✓ | X | ✓ | X | X |
Phase correlation | X | ✓ | X | X | ✓ | ✓ | |
CPD | ✓ | ✓ | X | X | ✓ | X |
Note
When using the NDT, LOAM, or FGR technique, you must specify a Grid
Step value in the Registration Parameters
pane. The grid step varies depending on the x-,
y-, and z-limits of the point clouds.
Typical values are in the range of
[0.1
,4.0
].
Follow these steps to align two point clouds using the ICP registration technique.
Import a moving and fixed point cloud by following the steps in the Import Point Clouds section.
In the Registration Techniques section of the app toolstrip, select ICP. Note, the Registration Parameters pane will show the default values used for the selected registration technique.
Select Register Point Clouds.
After registration, the center pane is replaced with the Imported Point Clouds pane, which shows the point clouds prior to registration, and the Aligned Point Clouds pane, which shows the point clouds after registration. The Registration Trials pane displays the registration ID, technique, root mean square error (RMSE) of the aligned points, and runtime in seconds for the registration. The runtime includes preprocessing time. To delete a registration trial, in the Registration Trials pane, right-click it and select Delete Registration Trial from the context menu, or select it and press Delete.
Add an Initial Transformation from the Workspace
Follow these steps to add a custom initial transformation for the ICP, NDT, or LOAM registration technique:
Define a
rigidtform3d
transformation object, or load one into the MATLAB workspace.In the Registration Parameters pane, set the parameter to From Workspace.
In the Import Initial Transformation dialog, select the transformation from your workspace. The selected transformation appears in the Registration Parameters pane and becomes available to all registration techniques that support an initial transformation.
Note
Each imported initial transformation must have a unique name. If you attempt to import an initial transformation object with the same name as one you have already imported, the import list does not display the new transformation as an option.
Add Preprocessing Steps for Point Cloud Registration
You can select any combination of preprocessing steps and interactively modify their parameters. Use these tips to select preprocessing steps:
Try an initial registration before adding any preprocessing steps. This enables you to evaluate whether you need to add any preprocessing.
When you apply multiple preprocessing steps, the app applies them in the order in which you add them. The Preprocessing pane shows the order of the steps and which technique each applies.
When you modify the parameters of a step, the app reapplies your preprocessing steps and updates the Imported Point Clouds (Preprocessed) pane to display their effect.
To delete a preprocessing step, right-click it and select Delete Preprocessing Step from the context menu, or select it and press Delete. When you delete a step, the app removes it from the selected registration trial.
Preprocessing steps can take a long time for large point clouds as the app reapplies preprocessing steps after each parameter update. Consider deselecting the Preview Preprocessing option. This only removes the display preview, not the steps.
Specify a similar value for the Voxel Size parameter of the Downsample preprocessing step as for the value of the Grid Step parameter for FGR registration.
This app includes Region of Interest (ROI), Downsample, and Ground Removal preprocessing techniques.
Region of Interest (ROI)
Select a region of interest to constrain registration to use points in the specified region. This can improve both speed and accuracy, especially if you know that an area of your point cloud contains a higher number of outliers or inliers than the rest of the point cloud. ROI is the least computationally intensive preprocessing step available. When including this step, consider adding it before the other preprocessing steps to improve the preprocessing speed for subsequent steps.
Cylinder
— Also known as range filter, use this ROI to select a cylindrical region, such as to exclude the ego vehicle and noisy points detected far from the sensor. Use this for lidar sensors.Cuboid
— Select a region of interest defined as an axis-aligned cuboid. If your point clouds have a known area of overlap, you can select it as the ROI by specifying the X-, Y- and Z- limits that define a cuboid containing that region.
Downsample
Improves the accuracy and speed of registration by reducing the number of points to use for registration to a representative set of points. The app supports these downsampling methods:
Voxel Filter
— Average points within the same voxel to a single point. Preserves the shape of the point cloud better than the Random method, but is slower. Note that LOAM registration does not support this method, asVoxel Filter
loses the organized structure of the point cloud required by LOAM registration. This method provides the most reproducible downsampling results, as it does not include a random component.Random
— Randomly selects a percentage of points from the input point cloud. Faster than theVoxel Filter
method, but can lose details of the shape of the point cloud if it excludes too many points.Nonuniform Grid Sample
— Divides the point cloud into grid boxes that each contain a specified number of points or fewer. Then the method randomly selects a single point from each grid box. If the input point cloud does not provide a normal value, this method automatically fills in the normal property, which the ICP registration technique also uses for itsPlane to Plane
andPoint to Plane
methods.
Ground Removal
Removing the ground in a point cloud scene usually reduces registration time. For some scenes, ground removal can improve the accuracy of the registration, because the points containing the ground are similar throughout the point cloud. In other cases, the ground plane improves registration accuracy along the z-axis, so removing the ground is not always the best option. The LOAM algorithm uses planar surfaces for registration, so ground removal is not recommended. For reproducible results, select the SMRF method. The plane fitting method has a random component, so the results are different between runs. The app supports these downsampling methods:
Simple Morphological Filter (SMRF)
— Recommended for irregular ground planes with elevation. Use SMRF when a plane model does not accurately represent the ground in the scene. SMRF is slower, but more accurate, than the plane fitting method.Plane Fitting
— Faster, but less accurate than theSMRF
algorithm.Plane Fitting
is recommended when the ground is a well-defined planar surface with no incline or a small, regular incline. Uses the M-estimator sample consensus (MSAC) algorithm to find the plane. The MSAC algorithm is a variant of the random sample consensus (RANSAC) algorithm. Results can change between preprocessing trials. If the point cloud data available before this preprocessing step does not meet the parameters set for plane fitting, the app issues a warning. Best practice is to modify the parameters or remove this preprocessing step.
Export Registration Results
You can export any registered trial by selecting the trial in the Registration Trials pane, then select Export. You must register a trial before you can export it. You can export the aligned moving point cloud and transformation to the workspace, or export the registration trial to a MATLAB function.
Export Results to the Workspace
To export the resulting aligned moving point cloud and the transformation to the
workspace, select Export and then Export Results To
Workspace. The app opens the Export Results To Workspace dialog box
and specifies the Variable Name parameter as
registrationResults
. Change the Variable
Name parameter if required. Otherwise keep the default variable name
and click OK. The app exports a structure
,
with these fields.
Generate a Function
To generate MATLAB code that registers point clouds using the desired registration technique and preprocessing steps, select Export and then Generate MATLAB Function. The app opens the function containing the autogenerated code, with integrated comments, in the MATLAB editor. To save the code in the MATLAB editor, click Save.