$npx -y skills add matlab/matlab-agentic-toolkit --skill matlab-point-cloud-registrationRegister 3-D point clouds using ICP, NDT, LOAM, FGR, phase correlation, and CPD algorithms. Use when registering or aligning 3-D point clouds, choosing a registration algorithm, tuning registration parameters, preprocessing point clouds for registration or combining point clouds
| 1 | # Point Cloud Registration |
| 2 | |
| 3 | Select `pcregistericp` with `Metric="planeToPlane"` as the starting point, evaluate algorithm accuracy using RMSE, and align the point clouds using `pcalign`. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - User asks to register, align or match 3-D point clouds represented as `pointCloud` objects |
| 8 | - User needs to choose or tune a registration algorithm |
| 9 | - User wants to build a map from multiple lidar scans |
| 10 | - User wants to combine or merge registered point clouds |
| 11 | - User asks about initial transformation estimation for registration |
| 12 | - User asks to preprocess point clouds before registration |
| 13 | |
| 14 | ## When NOT to Use |
| 15 | |
| 16 | - User wants to register 2-D point clouds (use `matchScans`, `matchScansGrid`, or `matchScansLine`) |
| 17 | - User wants image registration (use `imregtform` or `imregcorr` from Image Processing Toolbox) |
| 18 | |
| 19 | ## Required Toolboxes |
| 20 | |
| 21 | - Computer Vision Toolbox |
| 22 | - Lidar Toolbox |
| 23 | |
| 24 | ## Legacy Patterns to Avoid |
| 25 | |
| 26 | | Do NOT use | Use instead | Why | |
| 27 | |------------|-------------|-----| |
| 28 | | `rigid3d` for InitialTransform | `rigidtform3d` | `rigidtform3d` uses the premultiply transformation convention, which is more commonly used.| |
| 29 | |
| 30 | ## Algorithm Selection Guide |
| 31 | |
| 32 | ### Local Registration |
| 33 | |
| 34 | If you have an initial transformation or the point clouds are only slightly misaligned, try these local registration methods in this order. Use the RMSE output as the accuracy metric to minimize. |
| 35 | |
| 36 | | Algorithm | Function | Notes | |
| 37 | |-----------|----------|-------| |
| 38 | | Generalized ICP (plane-to-plane) | `pcregistericp` with `Metric="planeToPlane"` | Default starting point. Additionally, try `"planeToPlaneWithColor"` if the point cloud has color. | |
| 39 | | ICP (point-to-plane) | `pcregistericp` with `Metric="pointToPlane"` | Additionally, try `"pointToPlaneWithColor"` if the point cloud has color. | |
| 40 | | ICP (point-to-point) | `pcregistericp` with `Metric="pointToPoint"` | Simplest metric. Try if plane-based metrics are inaccurate. | |
| 41 | | LOAM | `pcregisterloam` | Requires organized point clouds. If the point cloud is not organized, but you have the lidar parameters available, use `pcorganize` to organize the point cloud. Use `detectLOAMFeatures` first to tune feature detection. It gives you more flexibility on the accuracy vs speed tradeoff since `detectLOAMFeatures` has parameters to control the number of features. | |
| 42 | | NDT | `pcregisterndt` | Tune the `gridStep` parameter for the scale of the scene. | |
| 43 | |
| 44 | ### Ground Data Registration |
| 45 | |
| 46 | If you don't have an initial transformation, but you know that the data corresponds to ground data, try phase correlation. |
| 47 | |
| 48 | | Algorithm | Function | Notes | |
| 49 | |-----------|----------|-------| |
| 50 | | Phase Correlation | `pcregistercorr` | Specifically designed for ground data. Not a local registration method. | |
| 51 | |
| 52 | ### Global Registration |
| 53 | |
| 54 | If there is no initial transformation and the point clouds are significantly misaligned (overlap less than 50%), first use a global registration approach to align the moving point cloud to the fixed point cloud, then optionally use a local registration method as a refinement step to improve accuracy. Note that global registration approaches are usually slower than local ones. |
| 55 | |
| 56 | | Algorithm | Function | Notes | |
| 57 | |-----------|----------|-------| |
| 58 | | FGR | `pcregisterfgr` | Feature-based approach. | |
| 59 | | CPD (rigid) | `pcregistercpd` with `Transform="Rigid"` | Probabilistic framework. It handles outliers well. Use for small point clouds. | |
| 60 | | CPD (nonrigid) | `pcregistercpd` with `Transform="Nonrigid"` | Only option for non-rigid/deformable registration. | |
| 61 | | FPFH feature matching | `extractFPFHFeatures` + `pcmatchfeatures` + `estgeotform3d` | Extract FPFH descriptors, match features, and estimate the transformation using the MSAC algorithm (a variant of RANSAC). Tune `NumNeighbors` in `extractFPFHFeatures` and `gridStep` in `pcdownsample` to ensure enough features and feature matches. | |
| 62 | |
| 63 | ### General Guidelines |
| 64 | |
| 65 | - The initial transformation is the transformation that aligns the moving point cloud to the fixed point cloud. It is important to set the `InitialTransform` name-value argument for local registration algorithms when an estimate is available. If registering a sequence of point clouds and no other estimate is available, assume constant speed and set the initial transformation to the transformation estimated between the previous pair of point clouds. |
| 66 | - The RMSE output of `pcregisterfgr` is not comparable to the RMSE output of the other registration functions because it is the root mean squared error between only inlier points. Use the Point Cloud Registration Analyzer app for comparable RMSE v |