Skip to main content

Introduction

pcl.js is a Point Cloud Library (PCL) that runs in the browser, powered by Emscripten and WebAssembly.

The Point Cloud Library (or PCL) is a large scale, open project for 2D/3D image and point cloud processing. The PCL framework contains numerous state-of-the art algorithms including filtering, feature estimation, surface reconstruction, registration, model fitting and segmentation. These algorithms can be used, for example, to filter outliers from noisy data, stitch 3D point clouds together, segment relevant parts of a scene, extract keypoints and compute descriptors to recognize objects in the world based on their geometric appearance, and create surfaces from point clouds and visualize them – to name a few.

Basic Usage Example

TypeScript
import * as PCL from 'pcl.js';async function main() {  // Initialization  await PCL.init({    url: 'https://cdn.jsdelivr.net/npm/pcl.js/dist/pcl-core.wasm',  });  // Get PCD file  const data = await fetch('https://cdn.jsdelivr.net/gh/luoxuhai/pcl.js@master/data/table_scene_lms400.pcd').then(res => res.arrayBuffer());  // Load PCD file data, return point cloud object  const cloud = PCL.loadPCDData<PCL.PointXYZ>(data, PCL.PointXYZ);  // Removing outliers using a StatisticalOutlierRemoval filter  // See: https://pcl.readthedocs.io/projects/tutorials/en/master/statistical_outlier.html#statistical-outlier-removal  const sor = new PCL.StatisticalOutlierRemoval<PCL.PointXYZ>(PCL.PointXYZ);  sor.setInputCloud(cloud);  sor.setMeanK(40);  sor.setStddevMulThresh(1.0);  const cloudFiltered = sor.filter();  // Save filtered point cloud objects as PCD files, the content is ArrayBuffer  const cloudFilteredData = PCL.savePCDDataASCII(cloudFiltered);}main();
OriginalFiltered
JavaScriptC++

Edit pcl.js-StatisticalOutlierRemoval