An optional companion extension mobilitydb_pcl lives under contrib/pcl/. It links the running PostgreSQL backend against the Point Cloud Library and exposes a small set of per-pcpatch operations as SQL functions. Schema-aware point-type dispatch picks pcl::PointXYZ, pcl::PointXYZI, or pcl::PointXYZRGB at call time based on the dim layout of the input pcid.
pcpatch_to_pcd(pcpatch) → bytea and pcpatch_from_pcd(bytea, pcid) → pcpatch — round-trip through PCL's PCD wire format. Round-trip preserves all dim values bit-exactly.
pcpatch_voxel_grid(pcpatch, leaf double precision) → pcpatch — VoxelGrid down-sampling, leaf in the schema's spatial units. Preserves Intensity / RGB.
pcpatch_sor(pcpatch, k integer DEFAULT 50, stddev_mul double precision DEFAULT 1.0) → pcpatch — Statistical Outlier Removal. Drops points whose mean distance to their k nearest neighbours falls outside (mean ± stddev_mul × stddev). Preserves Intensity / RGB.
pcpatch_icp(source pcpatch, target pcpatch, max_iter int DEFAULT 50, max_corr double DEFAULT 1.0) → double[] and pcpatch_gicp(...) with the same signature — IterativeClosestPoint and GeneralizedICP rigid registration. Both return an 8-element double array [tx, ty, tz, qw, qx, qy, qz, fitness] composable into a MobilityDB pose via pose_make_3d. GICP's Mahalanobis cost over per-point local covariances is markedly more robust than ICP on non-planar / vegetated surfaces (road-corridor scans, photogrammetric heritage facades).
pcpatch_normals(pcpatch, k int DEFAULT 10) → double[] — per-point surface normal + curvature via PCL's NormalEstimation<PointXYZ, Normal> over the k nearest neighbours. Returns a flat array of length 4 × npoints laid out as [nx_0, ny_0, nz_0, curv_0, nx_1, ny_1, nz_1, curv_1, …]. Use cases: oriented-surface change detection across repeat surveys, Potree --normal export, photogrammetric mesh seeding. For very large patches (>50 k points) consider down-sampling with pcpatch_voxel_grid first.
The bridge is gated behind CREATE EXTENSION mobilitydb_pcl in databases that have already loaded pointcloud + mobilitydb. Build instructions and a deterministic regression suite are in contrib/pcl/README.md.