← udacity portfolio
self driving car nd · computer vision · April 2019

LIDAR Object Clustering

Filter ground, build a k-d tree, Euclidean-cluster obstacles. C++ from scratch on PCL — no ML, all classical geometry.

What it did

Process raw LIDAR .pcd frames into bounding boxes around discrete obstacles (cars, pedestrians, cyclists) on a moving ego vehicle, then render the result. The whole pipeline was hand-written in C++ on top of PCL — no ML, no deep learning, no black boxes.

The pipeline

  1. Voxel-grid downsample. Raw LIDAR returns ~100k points per frame; most are spatial noise or redundant samples of the same surface. A voxel grid reduces this to ~5–10k while preserving structure.
  2. Region-of-interest crop. Drop everything outside an axis-aligned box centered on the ego vehicle — no need to cluster the sky or the side of the road 50 m away.
  3. Custom RANSAC ground-plane filter. Hypothesize a plane from 3 random points, count inliers, repeat N times, keep the best plane. This separates the road surface from “everything else.”
  4. k-d tree construction on remaining points. Built from scratch (not the PCL one) — recursive 3-D median splits, point-to-point nearest-neighbor query.
  5. Euclidean clustering. For each unvisited point, BFS-flood through neighbors within distance d; emit each connected component as a cluster.
  6. Bounding boxes + render. Axis-aligned boxes around each cluster, drawn with PCL’s viewer.

What I’d do differently with hindsight

What it taught me

Classical 3D geometry has a craft to it: knowing when a problem factors cleanly into voxelize → fit plane → tree → cluster, and how each step’s hyperparameter (voxel size, RANSAC iterations, cluster tolerance) trades precision for runtime. The lesson generalized: don’t reach for the deep model before you’ve spent an hour with a notebook and the data.


Source archive: Shivam-Bhardwaj/LIDAR-object-clustering (archived)
Writeup last touched: 2026-05-22