8. 3D Sensors & Depth Sensing

Stereo vision, Time-of-Flight, structured light, LiDAR, 4D radar, sonar, and 3D data formats

Contents
1. Taxonomy of 3D Sensors 2. Stereo Vision & Disparity 3. Time-of-Flight (ToF) Sensors 4. Structured Light 5. Passive vs Active Sensors 6. LiDAR 7. 4D Imaging Radar 8. Multi-beam Sonar 9. Sensor Comparison 10. 3D Data Formats Interactive: Stereo Depth Pipeline Flashcards

1. Taxonomy of 3D Sensors

The real world is three-dimensional, yet 2D images discard all depth information — a person at 2 m and at 20 m can project to the same pixel pattern. 3D sensing restores the lost depth dimension, enabling applications impossible with 2D data alone.

All 3D sensors divide into two fundamental categories based on whether they emit their own energy signal:

Two Fundamental Categories

Passive sensors — do NOT emit energy; rely entirely on ambient light:

  • Stereo cameras (e.g., ZED Mini)
  • Moving single camera (Structure from Motion)
  • Light-field sensors

Active sensors — emit their own signal (IR, laser, EM, acoustic):

  • Time-of-Flight cameras (e.g., Kinect v2, Azure Kinect)
  • Structured light (e.g., Kinect v1)
  • LiDAR (e.g., Velodyne, Faro)
  • 4D imaging radars
  • Multi-beam sonars

Supportive Sensors

Active and passive 3D sensors are often combined with supportive sensors that do not measure depth directly but provide auxiliary position and orientation information:

These are essential for aerial LiDAR (GPS/IMU tell you where the aircraft was oriented when each pulse fired) and mobile mapping.

Direct Depth SensorsIndirect Depth Sensors
MechanismPhysically measures distance (time-of-flight, triangulation)Depth computed from image correspondences
ExamplesToF, structured light, LiDAR, radar, sonarStereo cameras, single moving camera
Works in darkness?Yes (emit own signal)No (need ambient light)
Texture dependenceNone to lowHigh — need visual features to match

2. Stereo Vision & Disparity

Stereo vision exploits the same principle as human depth perception: two slightly offset viewpoints create parallax — nearby objects shift more between the two views than distant objects.

Disparity concept: eyes fixate on one object while others appear at different visual angles
Binocular disparity: when fixating on one object, others appear at slightly different visual angles in each eye. Larger angular difference = closer object.
Key insight
A single image contains no depth information. Depth is fundamentally ambiguous from one viewpoint: a small nearby object and a large distant object can project to identical pixel patterns. Two viewpoints resolve this ambiguity.

Stereo Disparity Equation

Consider left and right cameras separated by baseline $b$. A 3D point projects to pixel $p_L$ in the left image and $p_R$ in the right image. The disparity is $d = p_L - p_R$.

Disparity-to-Depth Equation (MEMORIZE)
$$z = \frac{b \cdot f}{p \cdot d}$$
SymbolMeaningUnit
$z$Depth to scene pointmeters
$b$Baseline (distance between optical centres)meters
$f$Focal lengthmeters
$p$Pixel width (physical size of one pixel)m/pixel
$d$Disparity (pixel displacement)pixels
If $f$ is given in pixels (already incorporating $p$), simplifies to: $z = b \cdot f_\text{px} / d$

Derivation via similar triangles: left camera projects point $P = (X, Y, Z)$ to $p_L = f(X + b/2)/Z$, right camera to $p_R = f(X - b/2)/Z$. Disparity $d = p_L - p_R = fb/Z$, so $Z = fb/d$.

Key Relationships

RelationshipExplanation
$z \propto 1/d$Depth is inversely proportional to disparity — double the disparity, half the depth
$z \propto b$Depth is directly proportional to baseline — wider baseline = better depth resolution for far objects
$z \propto f$Depth is directly proportional to focal length — longer focal length = better depth precision
Disparity-to-depth computation diagram
Disparity-to-depth: $z = (b \cdot f) / (p \cdot d)$. Brighter pixels in the disparity map = higher disparity = closer objects.

Disparity Map

By finding correspondences across the full image pair, we obtain a disparity map where each pixel value encodes the horizontal displacement between left and right views:

Standard noisy disparity map
A raw disparity map: depth values found only for textured areas; significant noise. Brighter = closer.
Depth enhancement: before and after processing
Depth enhancement: raw disparity map (left) vs. enhanced map after watershed/inpainting (right).

Stereo Enhancement Techniques

TechniqueDescription
Watershed transformRegion-growing propagates known disparity into neighboring unknown pixels, using image contours as boundaries
Inpainting / Hole fillingInterpolates missing values from surrounding known values using diffusion or patch-based methods
CNN-based fillingDeep learning predicts dense, complete depth from sparse stereo input — state of the art
Bilateral / guided filteringSmooths noise while preserving sharp depth edges at object boundaries
Problems with stereo depth estimation
  • Correspondence problem: Finding which pixel in the right image corresponds to a given left-image pixel is the hardest part — closely related to feature matching
  • Textureless surfaces: Blank walls and uniform regions have no unique features — disparity cannot be computed
  • Occlusions: Parts visible in one camera may be hidden in the other — no correspondence exists
  • Noise and mismatches: Lighting changes, shadows, and reflections cause incorrect matches
ZED Mini stereo camera depth output
ZED Mini stereo camera: RGB views (top) and corresponding depth maps (bottom). Passive stereo fails in low light and on textureless surfaces.

3. Time-of-Flight (ToF) Sensors

A ToF sensor measures depth by timing how long a light signal takes to travel to a scene point and return. It floods the entire scene with modulated infrared (IR) light and measures the phase shift independently at every pixel simultaneously — producing a dense depth map at real-time rates.

ToF Distance Equations

Direct time measurement:

$$\text{Distance} = \frac{t \times c}{2}$$ where $t$ = round-trip time, $c = 3 \times 10^8$ m/s (speed of light). Factor of 2 for the round trip.

Phase-shift method (practical implementation):

$$\text{Distance} = \frac{c \cdot \phi}{4\pi \cdot f_\text{mod}}$$ where $\phi$ = measured phase shift (radians), $f_\text{mod}$ = modulation frequency (Hz).

Direct nanosecond timing is impractical for consumer electronics. Instead, ToF sensors use continuous-wave modulation: the sensor emits a periodic signal, the reflected signal arrives with a phase delay, and the sensor correlates the sent and received signals to extract the phase shift (and thus the distance).

ToF signal correlation principle
ToF correlation: close objects (left) produce short delays with closely aligned correlation peaks; far objects (right) produce longer delays with shifted peaks.

ToF Hardware — Kinect One (v2)

Kinect One teardown: RGB camera, IR sensor, IR illuminator
Kinect One (v2) teardown: RGB camera (red), IR sensor array (green), and IR illuminator (blue). The illuminator and sensor work as a pair to measure per-pixel phase shift.
ComponentFunction
RGB cameraCaptures standard color images (not used for depth — provides color overlay)
IR illuminatorEmits modulated infrared light that floods the entire scene uniformly
IR sensor array2D pixel array sensitive to IR; measures phase shift at each pixel independently
Common exam trap — Kinect v1 vs v2
Kinect v1 (Xbox 360): uses structured light (projects an IR dot pattern). NOT a ToF sensor.
Kinect v2 / Kinect One (Xbox One): uses Time-of-Flight with IR illuminator + IR sensor array.
Azure Kinect (Microsoft): modern ToF successor with improved accuracy and range.
They look superficially similar but use completely different depth-sensing principles.
ToF depth map example
Depth map from a ToF sensor: brighter = closer, darker = farther. Dense, per-pixel depth at real-time frame rates.
PropertyToF Sensor
TypeActive (emits modulated IR)
Works in darknessYes
Typical range0.5 m to 4–5 m (consumer); longer for industrial
OutputDense depth map at 30+ fps
Accuracy~cm level
Software complexityLow (direct per-pixel measurement, no matching)
Main limitationsMultipath interference; strong sunlight can overwhelm IR sensor; limited range for consumer devices

4. Structured Light Sensors

Structured light computes depth by active triangulation: a projector emits a known pattern (stripes, dots, grid) onto the scene; a camera at a known distance from the projector observes how the pattern deforms on 3D surfaces. The deformation encodes depth.

Structured light triangulation diagram
Structured light triangulation: a stripe projector (left) projects light stripes onto a shaped object (hand). A matrix camera (right) observes the deformed pattern. Known geometry of the triangle (baseline, projection angle, observation angle) yields depth.

Triangulation Geometry

KnownDescription
Pattern element identityWhich specific stripe or dot was projected (each has a unique code)
Camera pixel positionWhere that element appears on the camera sensor $(u, v)$
Triangulation base $\zeta$Measured distance between projector and camera
Projection angleAngle at which each pattern element was projected

The unknown is depth — the distance to the surface where the pattern element landed. Basic trigonometry from the projector-camera-surface triangle yields it.

Kinect v1 internal components
Kinect v1 internal components: IR Emitter, Color Sensor, IR Depth Sensor, Tilt Motor, and Microphone Array. The Kinect v1 projects ~30,000 IR dots and observes their displacement.
PropertyStructured Light
TypeActive (emits IR pattern)
Works in darknessYes
Outdoor performanceWeak — sunlight washes out the projected IR pattern
Typical range0.5 m to 4 m
Accuracy~cm level
Software complexityHigh (pattern decoding, stripe identification, triangulation)
Best use casesIndoor 3D scanning, gesture recognition, face scanning (e.g., Apple Face ID)

5. Passive vs Active Sensors

Passive SensorsActive Sensors
Signal emissionNone — rely on ambient lightEmit own signal (IR, laser, EM, acoustic)
ExamplesStereo cameras, SfM, light-fieldToF, structured light, LiDAR, 4D radar, sonar
Works in darknessNOYES
Texture dependenceHIGHLOW or NONE
Depth qualityLower (noisy, incomplete)Higher (dense, accurate)
Experimental Comparison — ZED Mini vs Azure Kinect (Enigma Project)
Passive Stereo (ZED Mini)Active ToF (Azure Kinect)
In full darknessCompletely blind — no dataWorks perfectly — full depth data
Wall reconstructionNoisy, warped, wobbly surfacesThin, straight, geometrically accurate
Overall accuracyLower, significant distortionMuch higher, faithful to geometry

The same building interior, same conditions: active ToF produced clean reconstructions with straight walls and proper angles; passive stereo produced coarse, sparse, warped point clouds.

6. LiDAR

LiDAR stands for Light Detection And Ranging (or Laser Imaging Detection And Ranging). It uses the same time-of-flight principle as ToF cameras but with a focused laser beam instead of a flood of modulated IR — enabling much longer range and higher accuracy.

Why Laser Light Is Special

PropertyAdvantage for LiDAR
Monochromatic (single wavelength)Precisely known interaction with atmosphere, water vapor, and surface materials — no ambiguity in scattering models
Very narrow beamRemains tightly focused over long distances — maintains energy at hundreds of meters for precise point measurements
LiDAR Distance Equation
$$\text{Distance} = \frac{t \times c}{2}$$ Same time-of-flight principle as ToF. From measured distance $D$ and known firing angles ($\theta$ = elevation, $\phi$ = azimuth): $$X = D\cos\theta\cos\phi, \quad Y = D\cos\theta\sin\phi, \quad Z = D\sin\theta$$ Each pulse that returns creates one $(X, Y, Z)$ point in the point cloud. Millions of pulses per second.

LiDAR Scanning Mechanisms

MechanismGround PatternCommon Manufacturers
Oscillating mirrorSawtooth / Z-shapedLeica, Optech (most common)
Rotating polygonParallel linesVarious
Nodding mirror (Palmer scan)EllipticalVarious
LiDAR scanning mechanisms and ground patterns
LiDAR scanning mechanisms: oscillating mirror (sawtooth, most common), rotating polygon (parallel lines), nodding mirror (elliptical).

Velodyne LiDAR (Multi-beam, Real-time)

The Velodyne contains 8, 16, or 64 laser beams at different vertical angles that spin together via a rotating mechanism, producing full 360-degree scans 10–20 times per second.

Velodyne multi-beam LiDAR diagram
Velodyne multi-beam LiDAR: 8/16/64 beams fire at different vertical angles from a rotating sensor, producing a 360-degree point cloud in real time.
Velodyne LiDAR point cloud of a road scene
Point cloud from a Velodyne LiDAR scan, colored by reflectivity/height. Road, vehicles, and surroundings are clearly resolved.

Faro LiDAR (Single-beam, High Precision)

The Faro uses a single laser beam with a rotating mirror, taking 2–20 minutes per scan but achieving millimeter precision. Used for architectural documentation and cultural heritage scanning.

Faro LiDAR scan of a cathedral
Faro LiDAR scan of a cathedral interior: every architectural detail — vaulted ceilings, columns, arches — captured with millimeter precision.

Aerial LiDAR

LiDAR mounted on aircraft or drones, combined with GPS (absolute position) and IRS/IMU (aircraft orientation at each pulse), for topographic mapping, forestry, and urban planning. A GPS ground base station provides differential correction.

Airborne LiDAR with GPS and IMU
Airborne LiDAR: aircraft fires pulses at ground while GPS and IRS/IMU track position and orientation. A GPS base station provides differential correction.
PropertyDepth Sensors (ToF, Structured Light)LiDAR
RangeShort (0.5–5 m)Long (tens to hundreds of meters)
OutputDense depth map (per-pixel)Sparse point cloud (discrete points)
SpeedReal-time (30+ fps)Velodyne: real-time; Faro: 2–20 min
Accuracy~cm~mm to cm
Cost$100–$1,000$1,000–$100,000+
Primary useIndoor, gaming, AR, roboticsAutonomous driving, surveying, mapping

7. 4D Imaging Radar

A 4D imaging radar uses electromagnetic (EM) pulses (millimeter-wave radio waves) and extracts four dimensions of information from each detection.

The Four Dimensions of 4D Radar
DimensionWhat It MeasuresHow
1. DistanceRange to objectTime-of-flight: $D = tc/2$
2. DirectionAzimuth anglePhase differences across antenna array (beam-forming)
3. HeightElevationVertical antenna array elements
4. SpeedRadial velocityDoppler effect — frequency shift of reflected signal
4D imaging radar principle
4D imaging radar: measures distance (up to 300 m), direction/azimuth, vertical height, and Doppler speed simultaneously.

The Doppler Effect (4th Dimension)

When an object moves toward the radar, reflected radio waves are compressed (shifted to higher frequency). When moving away, waves are stretched (lower frequency). The magnitude of the frequency shift is directly proportional to the object's radial velocity.

This is the critical differentiator of 4D radar: it senses not only where objects are but also how fast they are moving — invaluable for predicting whether a car ahead is braking, accelerating, or stationary.

4D radar performance in fog: camera vs radar comparison
4D radar in fog: camera image is nearly useless (blurry, low contrast), but the radar heatmap still clearly detects and localizes the car. Radio waves are largely unaffected by fog, rain, and dust.
Property4D Radar
Signal typeElectromagnetic (millimeter-wave radio)
RangeUp to 300 m
Weather robustnessExcellent — works in rain, fog, snow, dust, darkness
Unique capabilityDirect velocity measurement (Doppler)
vs LiDARLower spatial resolution, but all-weather
Primary useAutomotive ADAS, autonomous driving

8. Multi-beam Sonar

Multi-beam sonar uses acoustic pulses (sound waves) for underwater 3D sensing. Light and radio waves attenuate rapidly underwater and are useless beyond a few meters — only acoustic waves propagate effectively.

Sonar Distance Equation
$$\text{Distance} = \frac{t \times v_\text{sound}}{2}, \quad v_\text{sound} \approx 1500 \text{ m/s in seawater}$$ Same time-of-flight principle as LiDAR, but uses speed of sound (~1500 m/s) not speed of light ($3 \times 10^8$ m/s). Sound is ~200,000 times slower — time intervals are milliseconds (easy to measure) but measurement rate is slower.
Multi-beam sonar operating principle
Multi-beam sonar: a vessel emits a fan of acoustic beams downward; beams bounce off the seabed and return to hydrophones on the hull.
Sonar transducer internal structure
Sonar transducer: piezoelectric ceramic element (converts electrical signals to acoustic pulses), aluminum resonator, elastic adhesive, connector.

Sonar provides 3 dimensions of information: distance (range), direction (beam angle), and seabed material type (inferred from acoustic return character — hard rock reflects sharply; soft mud absorbs and scatters).

Multi-beam sonar seabed mapping
Multi-beam sonar seabed mapping (British Antarctic Survey): color-coded bathymetric map revealing 3D topology of the ocean floor — blue = deep, red = shallow.

9. Sensor Comparison

Sensor comparison table
Multi-objective comparison of depth sensing technologies: stereoscopic vision, structured light, and Time-of-Flight.
Kinect vs FARO radar chart
Radar chart: Kinect (depth sensor) vs FARO (LiDAR). No single sensor dominates all axes — the right sensor depends on your application.
Sensor TypeSignalPassive/ActiveRangeSpeedCostWeatherPrimary Use
Stereo CameraNone (passive)PassiveMidReal-timeLowPoor (needs light + texture)Robotics, ADAS
Structured LightIR patternActiveShort (~4 m)MediumMedium-HighIndoor onlyGaming, face scan
ToF CameraModulated IRActiveShort-MidReal-timeMedium-HighFairAR, indoor mapping
LiDAR (Velodyne)Laser pulseActiveLong (100+ m)Real-timeHighGoodAutonomous driving
LiDAR (Faro)Laser pulseActiveLongSlow (min)Very HighGoodSurveying, heritage
4D RadarEM pulseActiveUp to 300 mReal-timeMedium-HighExcellent (all weather)Automotive
Multi-beam SonarAcoustic pulseActiveUnderwaterMediumHighN/A (underwater)Marine mapping

Kinect vs Faro — Trade-off Summary

MetricKinect (Depth Sensor)Faro (LiDAR)
CostExcellent (~$100–200)Poor (tens of thousands)
SpeedExcellent (real-time, 30 fps)Poor (2–20 min/scan)
QualityLow–MediumExcellent
PortabilityExcellent (small, handheld)Low–Medium (tripod)
AccuracyLow (~cm)Excellent (~mm)
Key insight
No single sensor dominates on all axes. The Kinect excels at cost, speed, and portability — ideal for real-time consumer/robotics applications. The Faro excels at quality and accuracy — ideal for precision-critical surveying. The right sensor depends entirely on application requirements.

10. 3D Data Representation Formats

Once depth data is acquired, it must be stored and processed in a digital representation. Eight formats exist, each with fundamentally different trade-offs.

Overview of 3D data formats
Overview of 3D data representation formats: voxel grid, octree, point cloud, mesh, RGB-D, multi-view, NeRF, and Gaussian Splatting.

Voxel Grid

A regular 3D grid of cubic cells (voxels — volumetric pixels). Each cell is empty (0) or occupied (non-zero). Analogy: a 2D image is a grid of pixels; a voxel grid is a 3D grid of volume elements.

Voxel grid with human figures
Voxel grid: cells containing objects have non-zero values; vast majority of cells (air) are empty but still stored — memory wasteful.

Octree

A hierarchical tree that adaptively subdivides 3D space. The root is one large cube; only regions needing detail are recursively divided into 8 sub-cubes (octants). Homogeneous regions remain undivided.

Octree model of the Stanford Bunny
Octree of the Stanford Bunny: surface regions are finely subdivided; interior and distant exterior regions are large, undivided cells.

Point Cloud

An unordered set of 3D points $(X_i, Y_i, Z_i)$ representing object surfaces. Points may carry additional attributes: color, intensity, surface normal, classification. This is the native output of LiDAR sensors.

Point cloud of the Stanford Bunny
Point cloud: the Stanford Bunny as a dense cloud of colored 3D points — shape is clear but no surface connectivity exists.

Polygonal (Mesh) Model

Vertices, edges, and faces (triangles) form the standard computer graphics representation. GPUs are fundamentally designed to process triangles at extreme throughput.

Polygonal mesh at different resolutions
Polygonal mesh: Stanford Bunny at increasing resolution from coarse (few large triangles) to fine (thousands of small triangles).

RGB-D Image

A color (RGB) image paired with a depth (D) image, pixel-aligned. The direct output of ToF cameras and structured light sensors. Brighter depth pixels = closer.

RGB-D depth image of the Stanford Bunny
RGB-D depth image: the Stanford Bunny as a grayscale depth map. Brighter = closer. Only the front-facing surface is captured — this is 2.5D, not full 3D.

Multi-view Sequences

RGB images from multiple camera viewpoints with known camera poses. No depth is directly measured — just photos from many angles.

Multi-view sequence setup
Multi-view sequences: cameras positioned around a scene with known poses. These are the input to NeRF and Gaussian Splatting.

NeRF (Neural Radiance Field)

A neural network (MLP) that learns a continuous 3D scene representation. Given any 3D position and viewing direction, it outputs color and density. The entire scene is "baked" into the network weights.

NeRF Function
$$F_\Theta: (x, y, z, \theta, \phi) \rightarrow (r, g, b, \sigma)$$
  • Input $\mathbf{x} = (x, y, z)$: 3D spatial coordinates
  • Input $\mathbf{d} = (\theta, \phi)$: viewing direction (spherical angles)
  • Output $\mathbf{c} = (r, g, b)$: color (view-dependent)
  • Output $\sigma$: volume density (view-independent — matter either exists at a location or it doesn't)
Density $\sigma$ depends only on position; color depends on both position and direction (to model specular highlights and reflections).
NeRF as a continuous 5D function
NeRF: a 5D function mapping spatial position (3D) and viewing direction (2D) to color and density via a fully-connected neural network.
NeRF architecture
NeRF architecture: 8 layers of 256 channels process positional-encoded $(x,y,z)$ to output density $\sigma$. A separate 128-channel branch takes the 256-dim feature plus viewing direction and outputs color $(r,g,b)$.
NeRF pipeline: input images to novel view rendering
NeRF pipeline: multi-view images with known camera poses are used to train the MLP, which can then render photorealistic novel views from any viewpoint.
PropertyNeRF
MemoryCompact (~5 MB of MLP weights for an entire scene)
Rendering qualityHigh — photorealistic novel view synthesis
Training timeSlow — hours of GPU computation per scene
Dynamics/updatesNot supported — scene is baked into weights

Gaussian Splatting

Represents a 3D scene as a collection of 3D Gaussian ellipsoids, each with learnable position, shape (covariance), color (spherical harmonics), and opacity. Gaussians are projected ("splatted") directly onto the 2D image plane — much faster than NeRF's per-ray MLP queries.

Gaussian Splatting pipeline
Gaussian Splatting pipeline: SfM points initialize 3D Gaussians, which are projected via camera parameters, rendered with a differentiable tile rasterizer, and refined through gradient flow with adaptive density control.
Adaptive Density Control
SituationProblemSolution
Under-reconstructionNot enough Gaussians — region is blurry/incompleteClone: duplicate the Gaussian, let both copies optimize independently
Over-reconstructionGaussians too large — sharp edges are blurredSplit: divide the oversized Gaussian into two smaller, more precise ones
Gaussian Splatting adaptive density control
Adaptive density control: cloning fixes under-reconstruction (top row); splitting fixes over-reconstruction (bottom row).
3D Gaussian Splatting concept
Gaussian Splatting: a scene represented as 3D Gaussian ellipsoids with learnable position, shape, color, and opacity.

3D Format Comparison Summary

FormatSensor AggregationMemoryGPU RenderingDynamicsPhotorealismVolumetric
Voxel GridEasyHIGHNoEasyLowYes
OctreeEasyLowNoMediumLowYes
Point CloudEasyHIGHModerateN/ALowNo
Polygonal MeshHardLowBest (GPU native)EasyBestNo
RGB-D ImageNeeds pose infoLowEasyNoMediumNo
Multi-viewN/ALowN/ANoN/ANo
NeRFNo (retrain)LowFastNoHighYes (implicit)
Gaussian SplattingNo (retrain)LowFastestDifficultHighSemi

Flashcards