# Structured light

Structured light is a method used in 3D scanning and computer vision that measures the shape and depth of an object by projecting a predefined pattern of light onto the object's surface. The pattern can be either stripes, grids, or dots. The resulting distortions of the projected pattern reveals the object's solid geometry through triangulation, enabling the creation of a 3D model of the object. The scanning process relies on coding techniques for accurately detailed measurement. The most widely used ones are binary, Gray, and phase-shifting, each offering distinct advantages and drawbacks.
Structured light technology is applied across diverse fields, including industrial quality control, where it is used for precision inspection and dimensional analysis, and cultural heritage preservation, where it assists in the documentation and restoration of archaeological artifacts. In medical imaging, it facilitates non-invasive diagnostics and detailed surface mapping, particularly in applications such as dental scanning and orthotics. Consumer electronics integrate structured light technology, with applications ranging from facial recognition systems in smartphones to motion-tracking devices like Kinect. Some implementations, especially in facial recognition, use infrared structured light to enhance accuracy under varying lighting conditions.

## Process

Structured light measurement is a technique used to determine the three-dimensional coordinates of points on an object's surface. It involves a projector and a camera positioned at a fixed distance from each other—known as the baseline—and oriented at specific angles. The projector casts a structured light pattern, which can be either stripes, grids, or dots, onto the object's surface. The camera then captures the distortions in this pattern caused by the object's solid geometry, which reveal the surface shape. By analyzing these distortions, depth values can be calculated.
The measurement process relies on triangulation, using the baseline distance and known angles to calculate depth from the pattern's displacement via trigonometric principles. When structured light hits a non-planar surface, the pattern distorts predictably, enabling a 3D reconstruction of the surface. Accurate reconstruction depends on system calibration—which establishes the precise geometric relationship between the projector and camera to prevent depth errors and, consequently, geometric distortions from misalignment—and pattern analysis algorithms.

## Types of coding

Structured light scanning relies on various coding techniques for 3D shape measurement. The most widely used ones are binary, Gray, and phase-shifting. Each method presents distinct advantages and drawbacks in terms of accuracy, computational complexity, sensitivity to noise, and suitability for dynamic objects. Binary and Gray coding offer reliable, fast scanning for static objects, while phase-shifting provides higher detail. Hybrid methods, such as binary defocusing and Fourier transform profilometry (FTP), balance speed and accuracy, enabling real-time scanning of moving 3D objects.

### Binary coding

Binary coding uses alternating black and white stripes, where each stripe represents a binary digit. This method is computationally efficient and widely employed due to its simplicity. However, it requires the projection of multiple patterns sequentially to achieve high spatial resolution. While this approach is effective for scanning static objects, it is less suitable for dynamic scenes due to the need for multiple image captures. In addition, the accuracy of binary coding is constrained by projector and camera pixel resolution, and it needs precise thresholding algorithms to distinguish projected stripes accurately.

### Gray coding

Gray coding, named after physicist Frank Gray, is a binary encoding scheme designed to minimize errors by ensuring that only one bit changes at a time between successive values. This reduces transition errors, making it particularly useful in applications such as analog-to-digital conversion and optical scanning. In structured light scanning, where Gray codes are used for pattern projection, a drawback arises as more patterns are projected: the stripes become progressively narrower, which can make them harder for cameras to detect accurately, especially in noisy environments or with limited resolution. To mitigate this issue, advanced variations such as complementary Gray codes and phase-shifted Gray code patterns have been developed. These techniques introduce opposite or phase-aligned patterns to enhance robustness as well as to aid in error detection and correction in complex scanning environments.

### Phase-shifting

Phase-shifting techniques use sinusoidal wave patterns that gradually shift across multiple frames to measure depth. Unlike binary and Gray coding, which provide depth in discrete steps, phase-shifting allows for smooth, continuous depth measurement, resulting in higher precision. The main challenges are that depth ambiguities can occur because the repeating wave patterns make it difficult to determine exact distances, which requires extra reference data or advanced processing to resolve, and, because multiple images are needed, this method is not ideal for moving objects—as motion can create distortions and introduce artifacts in the measurement.

### Hybrid methods

To address the limitations of phase-shifting in dynamic environments, binary defocusing techniques have been developed, in which binary patterns are deliberately blurred to approximate sinusoidal waves. This approach integrates the efficiency of binary projection with the precision of phase-shifting, enabling high-speed 3D shape capture. Advances in high-speed digital light processing (DLP) projectors have further supported the adoption of these hybrid methods in applications requiring real-time scanning, including biomedical imaging and industrial inspection.
Fourier transform profilometry (FTP) measures the shape of an object using a single image of a projected pattern. It analyzes how the pattern deforms over the surface, enabling fast, full-field 3D shape measurement, even for moving objects. The process involves applying a Fourier transform to convert the image into frequency data, filtering out unwanted components, and performing an inverse transform to extract depth information. Although FTP is often used alone, hybrid systems sometimes combine it with phase-shifting profilometry (PSP) or dual-frequency techniques to improve accuracy while maintaining high speed.