Decode the projector column from a synchronized temporal intensity sequence.
Structured-lightdepth reconstruction
Camera–projector correspondence, triangulation, and failure modes—examined in a live synthetic scene.
This report traces one structured-light measurement from projected code to metric depth. The apparatus below exposes the optical and geometric assumptions directly: change a pattern, material, scene, or calibration variable, then compare the captured image with the reconstructed result.
- APPARATUS
- Calibrated camera + projector
- OUTPUT
- Depth, point cloud, and error
- SCOPE
- Instructional synthetic model
Interactive reconstruction model
Hold the defaults as a control, then change one variable at a time. Capture, decoding, and triangulation update from the same calibrated scene.
- 1EncodeSelect a projected code and surface response.
- 2ConfigureSet scene geometry and calibrated rig parameters.
- 3ObserveCompare capture, depth, point cloud, and error.
Adjust modelOcclusion portrait · B 120 mm+
Scene
Curved foreground surfaces and a rear receiver expose projector shadows, self-occlusion, and grazing-angle dropout.
i
Maps a PNG, JPEG, or WebP onto a calibrated planar target. Files are limited to 8 MB and 16 MP decoded, then resized to a 2048 px / 2 MP GPU budget. It changes albedo; it does not infer geometry.
Projection
i
Sets the number of sinusoidal periods across the projector. More periods improve phase sensitivity but increase wrapping ambiguity and sensitivity to blur.
i
Moves the starting fringe phase in the temporal sequence. The decoder subtracts the known offset, so geometry should remain stable; only sampling, clipping, and noise produce small changes.
i
Scales collected pattern energy. Longer exposure improves modulation SNR until pixels saturate; in a real moving scene it also increases motion blur.
i
Scales emitted optical power before inverse-square spreading and surface reflection. More power improves range and SNR but can saturate reflective regions.
Geometry
i
Camera–projector separation. A larger baseline creates more disparity and improves depth precision, but also enlarges occluded regions and correspondence search distance.
i
Moves both calibrated devices away from the target. Irradiance falls approximately with inverse square distance, while depth uncertainty grows approximately with Z².
i
Controls camera field of view and disparity scale. More focal pixels narrow the view and improve metric depth sensitivity for the same baseline.
Sensor
i
Adds signal-independent electronic noise to every exposure. Raising it destabilizes phase and correlation most strongly in dark or distant regions.
i
Sets the sensor’s photon-to-electron signal budget. More electrons improve shot-noise SNR; reflective highlights can still reach the simulated full-well limit.
i
Adds visible hemispheric illumination and background electrons. It brightens the scene but lowers coded-pattern contrast and increases photon shot noise.
i
Sets digitizer quantization levels. Low bit depth rounds small intensity differences, damaging phase and Gray decisions even when optical SNR is high.
Result diagnostics
FORWARD + INVERSE MODEL. Every geometry preset is rendered into the same calibrated camera/projector rig and rear receiver screen. Curved surfaces, holes, sharp depth steps, self-occlusion, and projector shadows therefore alter the captured codes and reconstructed output—not just the display mesh. Irradiance follows inverse-square spreading and surface foreshortening; ground truth remains a separate camera depth pass, while estimated points come only from captured and decoded frames.
Pattern library
Pattern design balances precision, ambiguity, capture speed, surface reflectance, and motion. There is no universal winner.
| Pattern | How it works | Frames | Precision | Motion | Try pattern |
|---|---|---|---|---|---|
Phase shiftSUBPIXEL | Sinusoidal fringes encode projector phase continuously. Excellent precision, but wrapped phase repeats every period. | 3–12 | 0.05–0.2 px | Low | ↗ |
Gray codeABSOLUTE | Binary stripes identify every projector column unambiguously. Adjacent codes differ by one bit, limiting edge errors. | 20–24 | 0.5–1 px | Low | ↗ |
Gray + phaseRECOMMENDED · CURRENT | Gray code resolves fringe order; phase shifting supplies subpixel correspondence. The metrology workhorse. | 14–28 | 0.05–0.2 px | Low | ↗ |
Coded IR dotsACTIVE STEREO | A fixed pseudo-random near-IR texture is matched against a calibrated reference with local normalized correlation. One exposure supports motion, but precision depends on local texture uniqueness. | 1 | 0.15–1 px | High | ↗ |
From pattern to 3D point
Every method has the same goal: pair one camera pixel with one calibrated projector coordinate. Temporal codes decode that coordinate across several frames; coded dots recover it by matching one local texture patch. Triangulation is identical after correspondence.
Kc, Kp — camera and projector intrinsics
R, t — rigid pose from camera to projector
(uc, vc) ↔ up — decoded correspondence
Match a unique camera patch to the calibrated reference along one epipolar row.
Encode a known coordinate in light.
Observe how the surface deforms it.
Recover projector ↔ camera matches.
Intersect rays to solve 3D points.
Confidence gate: shadowed, saturated, flat, repetitive, or geometrically unstable matches remain holes—no projector correspondence means no measured point.
How one camera pixel becomes one 3D point
Live example: B = 120 mm · d = 200.5 px · Z = 850 mm
Complete per-pixel equations
One camera pixel and one decoded projector column become one metric 3D point.
- 01 / DECODE
Intensity → projector column
Three phase frames recover the wrapped phase; Gray code supplies the fringe order.
Ik = a + b cos(φ + 2πk/3), k ∈ {0,1,2}φ = atan2[√3(I2 − I1), 2I0 − I1 − I2]up = (Wp/N) [m + φ/(2π)] - 02 / CAMERA RAY
Pixel → line in 3D
Undistort the camera pixel, apply calibration, and express its ray in the common frame.
x̃c = Kc−1[uc, vc, 1]Trc = RcTx̃c / ‖RcTx̃c‖X(λ) = Oc + λrc - 03 / PROJECTOR PLANE
Column → sheet of light
Top and bottom rays through the decoded column define one projector plane.
rt = rayp(up, 0), rb = rayp(up, Hp−1)np = (rt × rb) / ‖rt × rb‖np · (X − Op) = 0 - 04 / INTERSECT
Ray ∩ plane → metric XYZ
Solve one scalar distance along the camera ray, then recover the 3D point.
λ = np · (Op − Oc) / (np · rc)X = Oc + λrc
Return no point when modulation is weak, a frame saturates, the rays are nearly parallel, λ falls behind the camera, or reprojection fails.
Visibility + light transport
A surface point is measurable only if it is simultaneously visible to the camera and illuminated by the projector. The rear screen in the live scene makes the missing projector rays visible as real shadows.
M(X) = Vc(X) · Vp(X) · FOV(X) · 𝟙[SNR(X) > τ]Vc and Vp are independent camera and projector visibility tests.Camera occlusion
Vc = 0. Another object is nearer on the camera ray, so the camera never records the hidden point—even if the projector illuminates it.
Projector shadow
Vc = 1 but Vp = 0. The camera sees the background, but an object blocks its coded illumination. Modulation collapses and reconstruction must return a hole.
Mutual visibility
Vc = Vp = 1. The temporal code arrives, the camera decodes up, and triangulation can produce a measured 3D point.
Power spreads over area.
E(X) = P η T(up) max(0, n·l) / (Ω rp²)The live shader uses this inverse-square projector model: doubling projector-to-surface range gives approximately one quarter of the irradiance before camera exposure compensation. Oblique surfaces receive less through the cosine term.
Collimated does not mean lossless.
I(r,z) = 2P/[πw(z)²] · exp[−2r²/w(z)²]w(z) = w0√[1 + (z/zR)²]Near its waist a laser may stay nearly collimated; farther away diffraction expands the spot and lowers peak irradiance. Absorption and scattering add medium-dependent losses beyond geometric spreading.
Fewer detected photons → noisier phase.
Ne ∝ E(X) · ρ · texp · Tlens/Nf²For a resolved Lambertian surface, camera image irradiance follows scene radiance and lens f-number—there is not a second independent 1/r² penalty per pixel. Shot noise grows as √N while signal grows as N, so the pattern can remain faintly visible yet fall below the modulation threshold for reliable correspondence.
Rectified depth calculator
This compact form assumes a rectified camera–projector pair, so corresponding rows align. Both coordinates use one common rectified pixel grid; fx = fy = 1420 px and the principal point is (960, 600) px. It is the familiar stereo shortcut to the full ray–plane calculation above.
i
Selects the horizontal camera pixel in the worked triangulation example. Together with projector u, it determines disparity and therefore depth.
i
Selects the vertical camera pixel in the worked example. It changes reconstructed Y after the camera ray is unprojected.
i
Selects the decoded projector column. Moving it changes disparity d = u_c − u_p; small disparity means far or invalid depth.
camera (1120, 620) px ↔ projector column 920 px
X = (uc−cx)Z/fx · Y = (vc−cy)Z/fy
Interpolation policy
Triangulation returns an organized depth image with holes—not permission to connect every neighbor. Interpolation is justified only inside a locally continuous surface and should carry a separate “inferred” mask.
Confidence-weighted bilinear
ẑ(p) = Σiwicizi / ΣiwiciUse the four cell corners only when their depths agree within a surface threshold. wi is bilinear distance weight; ci is decode confidence.
Edge-aware weighting
wi = exp(−‖p−pi‖²/2σs²) exp(−|I−Ii|²/2σr²)ciSpatial and image-intensity similarity prevent foreground depth from bleeding across a visible silhouette.
Weighted plane fit
minn,δ Σiwi(n · Xi + δ)²Fit a plane to valid 3D neighbors, then intersect the missing pixel’s camera ray with it. Reject if residuals or normal spread are large.
Leave the hole
|zleft − zright| > τz ⇒ invalidDo not bridge foreground/background edges, projector shadows, specular dropouts, or long gaps. Multi-view fusion or learned completion may fill them, but those points are estimates—not structured-light measurements.