matlab-point-cloud-registration
This MATLAB skill registers 3-D point clouds using multiple algorithms including ICP variants, NDT, LOAM, and other methods. Use it when aligning point cloud objects, selecting or tuning registration algorithms, preprocessing point clouds, building maps from lidar scans, or combining registered point clouds into unified datasets.
git clone --depth 1 https://github.com/matlab/matlab-agentic-toolkit /tmp/matlab-point-cloud-registration && cp -r /tmp/matlab-point-cloud-registration/skills-catalog/image-processing-and-computer-vision/matlab-point-cloud-registration ~/.claude/skills/matlab-point-cloud-registrationSKILL.md
# Point Cloud Registration Select `pcregistericp` with `Metric="planeToPlane"` as the starting point, evaluate algorithm accuracy using RMSE, and align the point clouds using `pcalign`. ## When to Use - User asks to register, align or match 3-D point clouds represented as `pointCloud` objects - User needs to choose or tune a registration algorithm - User wants to build a map from multiple lidar scans - User wants to combine or merge registered point clouds - User asks about initial transformation estimation for registration - User asks to preprocess point clouds before registration ## When NOT to Use - User wants to register 2-D point clouds (use `matchScans`, `matchScansGrid`, or `matchScansLine`) - User wants image registration (use `imregtform` or `imregcorr` from Image Processing Toolbox) ## Required Toolboxes - Computer Vision Toolbox - Lidar Toolbox ## Legacy Patterns to Avoid | Do NOT use | Use instead | Why | |------------|-------------|-----| | `rigid3d` for InitialTransform | `rigidtform3d` | `rigidtform3d` uses the premultiply transformation convention, which is more commonly used.| ## Algorithm Selection Guide ### Local Registration 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. | Algorithm | Function | Notes | |-----------|----------|-------| | Generalized ICP (plane-to-plane) | `pcregistericp` with `Metric="planeToPlane"` | Default starting point. Additionally, try `"planeToPlaneWithColor"` if the point cloud has color. | | ICP (point-to-plane) | `pcregistericp` with `Metric="pointToPlane"` | Additionally, try `"pointToPlaneWithColor"` if the point cloud has color. | | ICP (point-to-point) | `pcregistericp` with `Metric="pointToPoint"` | Simplest metric. Try if plane-based metrics are inaccurate. | | 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. | | NDT | `pcregisterndt` | Tune the `gridStep` parameter for the scale of the scene. | ### Ground Data Registration If you don't have an initial transformation, but you know that the data corresponds to ground data, try phase correlation. | Algorithm | Function | Notes | |-----------|----------|-------| | Phase Correlation | `pcregistercorr` | Specifically designed for ground data. Not a local registration method. | ### Global Registration 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. | Algorithm | Function | Notes | |-----------|----------|-------| | FGR | `pcregisterfgr` | Feature-based approach. | | CPD (rigid) | `pcregistercpd` with `Transform="Rigid"` | Probabilistic framework. It handles outliers well. Use for small point clouds. | | CPD (nonrigid) | `pcregistercpd` with `Transform="Nonrigid"` | Only option for non-rigid/deformable registration. | | 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. | ### General Guidelines - 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. - 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 values between all registration approaches. - When comparing registration algorithms, check if the point clouds are organized (i.e., `ndims(ptCloud.Location) == 3`). If they are organized, include LOAM in the comparison. If they are not organized, but lidar parameters are available (e.g., from the sensor metadata or the user), use `pcorganize` to organize the point clouds and include LOAM in the comparison. Exclude LOAM when the point clouds are unorganized and no lidar parameters are available. - When registering a sequence of organized point clouds with LOAM, use `pcmaploam` to refine the transformations and improve map accuracy in addition to pairwise `pcregisterloam` registration. - Use `pcshowpair` to visualize the alignment between a pair of registered point clouds. ### Preprocessing Steps - When using `select` to filter points from an organized point cloud, always set `OutputSize="full"` to preserve the organized structure. - To improve the speed and accuracy of the registration, use `findPointsInCylinder` as a cylindrical filter to remove artifacts from the ego vehicle and noise from distant points. Only use `findPointsInCylinder` for point clouds from spinning lidar sensors. - Downsampling can speed up registration and improve accuracy by removing the effects of noisy points. Use `pcdownsample` to downsample the point clouds before registration. The recommended approach for registration is the `gridAverag
>
Import recorded driving sensor data (GPS, camera, lidar, actor tracks, lanes) into scenariobuilder.* objects (GPSData, CameraData, LidarData, ActorTrackData, Trajectory, laneData) and run preprocessing — synchronize, offset correction, crop, normalizeTimestamps, convertTimestamps. Also: compute actor tracks from lidar when no annotations exist, attach camera/lidar mounting + intrinsics, export to MAT/workspace/timetable/script. Use for raw driving dataset files (KITTI, nuScenes, Waymo, Pandaset, ROS/ROS2 bags, .mat, .csv, .mp4) or driving/vehicle/sensor logs that need wrapping. drivingLogAnalyzer (DLA) is OPT-IN ONLY — invoke only on explicit user request ('DLA', 'open in DLA', 'inspect/explore/analyze the recording') or reported sensor problem (sync drift, timestamp mismatch, overlay misalignment). NEVER auto-launch DLA after wrapping (Rule 0). For 'build scenario / export to RoadRunner / drivingScenario / OpenSCENARIO / Unreal / simulate', hand off to matlab-scenario-builder.
Generate driving scenes, scenarios, road surfaces, and 3D content from already-wrapped scenariobuilder.* sensor data (GPS, camera, lidar, actor tracks) using Scenario Builder for Automated Driving Toolbox. Use to BUILD, EXPORT, or AUGMENT a virtual scenario/scene/map: ego or actor trajectories, trajectory smoothing, OpenCRG road-surface extraction, 3D asset generation, static-object placement, point-cloud georeferencing + elevation, lane-based ego localization, sensor-fusion tracking, scenario-event extraction (cut-ins, hard brakes, near-misses, ADAS disengagements), or export to RoadRunner, drivingScenario, OpenDRIVE, OpenCRG, OpenSCENARIO, or Unreal Engine. Also: log-to-scenario, scenario harvesting, accident/near-miss reconstruction, SOTIF (ISO 21448) and ISO 26262 scenario coverage, USGS-aerial-lidar scene augmentation, traffic-sign placement from camera+lidar logs. NOT for raw-data import or multi-sensor sync/crop/offset/timestamp normalization — route those to matlab-driving-data-importer.
>
>
>
>
Build, modify, and diagram SimBiology models — API reference, helper functions, and layout patterns. Use when constructing or editing models programmatically or visually.