PHYSICAL AI | PERCEPTION ARCHITECTURE
Laser Line Scanning: From Calibration to Sub-mm Geometry
A laser line scanner measures a surface by finding where a camera ray meets a projected sheet of light. The geometry is straightforward. The harder work is identifying the stripe in the image, locating its center accurately, and using a calibration model that still describes the scene as the scanner or object moves.
Each stage affects the quality of the measurement. The material's optical response determines how clearly the stripe appears. Camera and laser calibration determine where a detected pixel lands in 3D. Geometric assumptions can narrow the search, but they can also exclude useful observations. Recovering missing points improves coverage only if those points belong to the surface being measured.
The lab makes these stages available for inspection and comparison. This article follows its workflow from optics to the final point cloud, explaining the equations, the implementation choices, and the limits of the evidence from its synthetic captures. A standalone companion with a smaller capture subset is available as LaserLineScan on GitHub. The implementation details here describe the website lab; the published companion may use an earlier version.
Overview
The workflow has two phases. Calibration establishes the camera model, the laser-plane geometry, and an estimated working-depth range. Scanning uses that profile to process a sequence of object images and their acquisition metadata.
Before reconstruction, the software checks that the calibration profile and scan data agree on the rig configuration, image geometry, and unit scale. These checks catch configuration mismatches. Motion requires a separate check: the capture and reconstruction models must interpret each command in the same way. This matters especially when the object rotates in front of a stationary sensor.
00 Optics
The optics step sets the laser wavelength, filter transmission, and ambient spectrum. Together, they shape the signal that reaches the sensor and the color response the detector should look for.
The detector needs to follow the optical design. A green stripe may be easy to see, for example, while remaining invisible to a detector that accepts only blue excess.


Optical model
Reliable geometry starts with a stripe the sensor can resolve. The lab models the laser spectrum, filter transmission, sensor response, and ambient spectrum before extracting the stripe.
The spectral model samples wavelengths from 380 to 1000 nm at intervals of . In simplified form, the sensor-weighted laser and ambient responses are:
Here, denotes ambient response; the plane coefficient , introduced below, is a separate quantity. The filter's contrast gain compares the laser-to-ambient ratio with and without filtering:
The model also accounts for the shift in filter wavelength with incidence angle:
Here, is the wavelength at normal incidence, is the incidence angle, and is the effective refractive index used by the model. A narrow bandpass filter can reject ambient light effectively while attenuating the laser at larger incidence angles, including toward the image edges. Its on-axis transmission alone does not describe that trade-off.
To approximate these effects, the lab separates an estimated stripe signal from the background in existing captures, scales the ambient component, and applies an angular gain at each pixel. The processing worker computes this gain field once per job; the preview evaluates the optical transform separately using the same design parameters.
Changing the optical design also updates the color score used by the main detector. A green or red stripe can therefore be evaluated against its intended color. The recovery stage has a separate color limitation, discussed later.
This model approximates image formation; its sensor curves and material responses are not calibrated radiometric measurements. Recoloring a capture cannot reproduce every effect of changing the physical light source. Wavelength selection still needs measurements with the intended sensor, optics, and material.
01 Rig
The rig view shows the camera–laser baseline and working distance. Both determine how a small shift of the stripe in the image translates into a change in measured depth. The controls illustrate these geometric relationships; they do not regenerate the captured images or change their calibration.


Measurement geometry
The pipeline represents the laser plane in camera coordinates as:
and are dimensionless. The coordinates and use the same length unit, with the captures scaled at mm per model unit.
For a detected image point , lens distortion is removed first, yielding normalized coordinates . The camera ray is . Substituting into the plane equation gives:
is the recorded acquisition translation. The last line gives the coordinates stored by the pipeline. This translation can align frames only when it correctly describes their relative motion; object rotation requires an additional transform.
Motion and coordinate frames
Calibration labels describe how the board and laser move during calibration. The scan sequence has its own motion model. In moving-sensor scans, the camera and laser translate together past a stationary object, keeping the sheet fixed in camera coordinates. In fixed-sensor scans, the head stays still while the object rotates through the sheet. Each pose has its own rendered image and depth map.
For the rotating-object sequence, the capture model inverts the commanded plane pose and applies it about the center of the scanned assembly, with a tilt of radians around the fixed sheet. In a shared scene coordinate frame, rotation about a pivot is:
Choosing the pivot changes the object's trajectory. A rotation about the emitter, for example, could move the object out of view. Surface reflectance and the modeled response of liquid are recomputed at each pose so that they follow the geometry.
The fixed-sensor path currently has two reconstruction limits. Although its captures use a fixed sheet in camera coordinates, reconstruction still derives a changing sheet from the motion commands through the calibrated encoder model. It also omits the inverse rotation needed to align the object poses. A command can pass the calibrated range check while selecting the wrong plane for the image.
Registering a rotated object requires the pose that maps its reference coordinates into the camera frame. If , the inverse transform is:
The rotating-object path still needs this registration step and a reconstruction plane that matches the fixed sheet. The renderer computes the object poses in world coordinates, but does not yet supply them to reconstruction as per-frame camera-coordinate transforms. Supplying reference depth for each frame gives the evaluator the correct target, but does not repair either part of the measurement model.
Sensitivity and pixel conventions
The denominator reveals where triangulation becomes sensitive to error. As it approaches zero, the camera ray becomes nearly parallel to the laser plane, so small parameter errors can produce large depth errors. With the plane held fixed, sensitivity to the normalized image row is:
The pipeline rejects non-finite depths and depths outside the range of 1–8 model units. It does not yet attach propagated uncertainty or a triangulation-angle quality score to each point. The plane equation also assumes an orientation for which the coefficient of can be normalized to one.
Pixel coordinates need a consistent convention throughout. Here, the origin lies at the image boundary, so the center of pixel is . Detected board corners are converted to the same convention. Otherwise, a half-pixel mismatch would become a systematic measurement offset.
02 Calibration
Calibration uses a board with known geometry to locate stripe observations in 3D. The lab provides two reference sets: a fixed board with a moving laser, and a moving board with a fixed laser.


Camera and laser calibration
Each reference set contains 50 views of an ChArUco board with 40 mm squares and 29 mm markers. A view needs at least 20 detected internal corners; the supplied references yield 35.
One calibration mode estimates how the laser plane changes with a command. The other fits a single plane fixed to the camera. The scan must then use the model that describes its actual motion.
The software detects board corners, initializes the camera intrinsics from the acquisition metadata, and refines the camera model when the views provide enough pose diversity. It then solves each board pose. It supports a pinhole model and common lens-distortion models. Where pose diversity is insufficient, as in the fixed-board reference set, camera intrinsics and distortion coefficients are supplied as known values. That experiment therefore does not independently recover every camera parameter.
Calibration and scanning share a detector. When an optical design is supplied, both use the color projection described below. Changing that score can shift both the fitted planes and the reconstructed scan points, so a comparison needs to account for both effects.
For a board plane , a detected stripe ray meets the board at:
The board geometry must use the reference scale. Intersections with near-zero denominators or depths outside the working range are rejected; the remaining 3D points form the observations for the laser-plane fit.
With a moving board and fixed laser, observations from multiple board poses are pooled to fit one plane in camera coordinates. Six passes of iteratively reweighted least squares start with equal weights, then reduce the influence of large algebraic residuals:
The outlier scale is 0.5 mm. The fit uses algebraic residuals, while the reported plane root mean square (RMS) uses orthogonal distances, , over retained inliers. An uncertainty calculation must account for that distinction.
With a fixed board and moving laser, the stripe defines a line on the board, which is insufficient to identify a unique laser plane. The pipeline adds the known emitter position and requires each plane to pass through it:
Affine maps relate the two laser-command coordinates to and ; the emitter constraint then determines . A command is rejected if either coordinate falls outside its calibrated range. Passing this rectangular range check does not establish that the fit is well conditioned at that command.
Both modes depend on the quality and diversity of the references. The implementation rejects singular systems but does not perform a full observability or conditioning analysis.
03 Object scan
Scanning decodes each frame and searches for the stripe within a predicted geometric band. It then checks the excluded rows, attempts to recover missing columns, and accumulates the reconstructed points. Once the sequence is complete, the result view receives the point cloud together with reconstruction error, coverage, and search-verification results.


Pipeline concurrency
Calibration and scanning run as separate tasks with their own working data, keeping controls, previews, and the 3D view responsive during processing.
Image downloads begin ahead of processing, allowing one frame to be decoded and measured while later frames are still arriving. Decoding uses a limited lookahead, although the software starts all image fetches without imposing the same bound on downloads.
Reference depth is also prefetched through a bounded lookahead. Each frame has its own depth map so that a change in object pose also changes the reference surface. The points are reconstructed before they are scored against that map. The detector does not sample these per-frame maps; it does use supplied geometry priors, described below.
During replay, missing-column recovery, reconstruction, and scoring wait until the display acknowledges that the frame has been presented. This makes the sequence inspectable. Total elapsed time includes display pacing, transfer, decoding, measurement, and evaluation. The per-frame processing figure combines worker time up to preview delivery with display preparation. It excludes the display hold and the missing-column recovery, reconstruction, and scoring that follow.
Overlapping these stages reduces waiting, but does not bound the memory use of the entire job or guarantee a real-time deadline. Live acquisition would need timestamps, bounded image queues, and explicit handling of late or dropped frames.
Color scoring and stripe localization
When an optical design is supplied, the detector scores each color pixel by projecting it onto the expected stripe color. Let be that RGB color and the transformed pixel in frame . For :
The background estimate approximates the median projection over a sample of the frame. The implementation samples every fourth pixel, bins the projections, and uses the midpoint of the median bin. Subtracting this single value adjusts for changes in the overall background level. It does not normalize exposure or correct local illumination, and a background that largely shares the laser color can bias the estimate.
Extraction and band verification use the same projection direction and background level. Without an optical design, the detector can use blue excess or the blue channel alone; monochrome frames use intensity. Blue excess is defined as:
The default threshold is the larger of a fixed floor of 40 and the 98th percentile of sampled scores, after integer binning:
The estimate samples every other column within the selected horizontal region of interest, across all rows. It is independent of the geometric row band used later, so narrowing that band does not itself lower the threshold.
The histogram has a numerical limit: a projection score can exceed its supported range even after background subtraction. The equation describes the intended rule within that range; unusually bright color mixtures can exceed it and abort extraction.
A candidate must satisfy and a local contrast condition, with the right-hand side set to 0.35 times the configurable floor (40 by default):
This rejects broad bright regions without a distinct peak. A narrow reflection in the selected color can still pass, because the test measures image contrast rather than surface identity.
The lab offers four center estimators: an integer maximum, a local intensity centroid, a quadratic peak fit, and a Hessian ridge estimator. The default ridge estimator smooths the score with a small Gaussian, then computes first and second derivatives.
Its directional Taylor step follows the principle behind Steger's curvilinear-structure detector. Let be the gradient, the Hessian, and the unit eigenvector associated with the smaller eigenvalue. That eigenvalue must be negative for a bright ridge. With consistently scaled derivatives, the estimated displacement toward the ridge is:
The implementation uses unnormalized derivatives and compensates for their scale in the step. It rejects a candidate if either displacement component exceeds 0.6 pixels in magnitude and clamps accepted components to pixels. Candidates are ranked by a combination of intensity and curvature, with one retained per column.
If no ridge candidate survives, a quadratic peak fit is attempted under the same intensity and contrast tests. For three vertical samples , the offset is:
The offset is clamped to pixels when the curvature is sufficiently negative.
This combination forms a hybrid estimator. Controlled tests check a straight Gaussian profile with error below 0.05 pixels, a slanted profile with RMS error below 0.15 pixels, and preservation of detections under saturation. Each test covers a specific property; the results do not establish a universal localization accuracy.
A color-score regression test also recovers the expected subpixel row of a green stripe that blue excess cannot detect. In a blue-stripe case, the detected-point count stays within 2% of the earlier result. These tests provide evidence for those inputs; other surfaces may shift the detected centers or change the accuracy.
Geometric bands and row gating
Calibration can reduce the area that needs expensive ridge processing. In the pinhole approximation, depth maps to image row:
Projecting the near and far limits of an expected depth interval gives a row band for each column. The software uses a supplied object-depth interval when available. Otherwise, it uses the 2nd and 98th percentiles of calibration stripe depths, adds a margin, and clips the interval to the supported range.
The band includes an approximate correction for lens distortion and can be restricted to a supplied object bounding box. In these synthetic datasets, the depth and box bounds are derived from rendered depth across all frames and rounded outward. These bounds are supplied priors: the scanner has not independently discovered the object's extent. They also depend on projecting the correct laser plane; widening the object bounds cannot fix a plane-model mismatch.
A heuristic margin widens the band using a depth term, the plane-fit residual, board reprojection error, and a default localization term of 0.5 pixels. The guard is three times the estimated row standard deviation, bounded between 4 and 160 pixels. Because it omits the full joint calibration covariance and parameter correlations, it does not establish a calibrated 99.7% confidence interval.
A learned row gate based on principal component analysis (PCA) can narrow the blue-excess search further. Color projection bypasses this gate because its model was trained on blue-excess background rows. For a sampled row , mean row , and orthonormal loading matrix , the gate computes:
Rows that differ from the learned background have larger residuals. The gate keeps the contiguous span covering rows above its learned threshold. If no row qualifies, the search retains the geometric band.
The gate is also bypassed for incompatible image dimensions, monochrome input, or a missing model. Its training rows came from the same image collection used for validation, so results with the gate enabled do not measure generalization to wholly unseen objects. Supporting the projection score would require new training and threshold validation; that path currently uses geometric bands alone.
Search verification
Restricting the search creates a need to check what was excluded. After extraction, the software examines scores outside each selected column's band, over rows where a candidate center could occur. It truncates each score to an integer before finding the maximum:
Here, is the set of excluded rows being checked, and the brackets denote a Boolean condition.
A flagged column is searched again after its band is widened around the strongest excluded row, with a default margin of six pixels. Up to two expansion passes are allowed. If flags remain, the frame is marked unqualified. The lab still allows those points to be reconstructed and exported; a production controller would need a policy for handling that status.
For integer scores, a maximum at or below rules out the required intensity condition in the checked rows. Fractional projection scores create a gap in this logic: a value just above can be truncated to and pass without a flag. Qualification therefore reflects the integer-binned check and does not guarantee that every eligible candidate was searched.
The check also leaves several questions open: whether the selected peak belongs to the intended surface, whether object priors excluded useful columns, and whether the reconstructed geometry is accurate. Points added later by recovery follow separate acceptance rules.
The computational saving has limits as well. Threshold estimation and verification still inspect scores outside the narrow band, and color projection needs a background estimate. Reducing the ridge search area therefore does not produce an equal reduction in memory traffic or total runtime. Frequent band expansion is useful diagnostic evidence, but several causes besides calibration drift can produce it.
Missing-column recovery
Transparent surfaces can produce a narrow surface return over a broad glow, shifting a peak or centroid away from the desired center. For columns where the primary detector found no point, recovery fits a profile of the form:
The polynomial represents the slowly varying background, and the Gaussian represents a possible surface return. With pixels fixed, the fit searches within four pixels of the peak in quarter-pixel steps, solving the linear coefficients at each candidate center.
Recovery requires evidence of broad glow and a peak above the configured intensity floor. For the mixture fit, the Gaussian amplitude must exceed 15% of that peak. A recovered center must also lie within four pixels of the neighboring stripe trend, supported by points no more than eight columns away. These checks limit unsupported fills, although a newly recovered point can support later recoveries and allow an error to propagate.
Saturated peaks have an additional recovery option with its own acceptance checks. If at least two samples reach the saturation level of 250, the software first tries fitting a parabola to the logarithm of unsaturated samples around the peak:
This shoulder fit is accepted when its curvature is negative and its estimated center is plausible. If it fails, recovery falls back to the mixture fit.
Recovery runs after band verification. It uses the fixed intensity floor, omits the adaptive threshold and ridge acceptance test, and still builds its color profile from blue excess. It receives neither the projection direction nor the frame's projected background level. Green and red designs therefore gain support in the main detector without equivalent support in recovery. Evaluating recovered points separately shows whether their additional coverage justifies any increase in error.
04 Dense 3D result
The result view displays the reconstructed surface, colored by depth, alongside error, coverage, and search-verification status. Its brief reveal animation begins after scanning finishes. The example below shows a synthetic rail head with a worn running surface.


Reconstruction evaluation
Accepted stripe centers are undistorted, intersected with the selected laser plane, and adjusted by the recorded translation. The evaluator then scores the frame's points against its reference depth in observation order. Point coordinates are established before reference values are used.
This separates per-point evaluation from stripe detection. Geometry priors derived from rendered depth and, when enabled, the row gate's training data still influence the result and need to be reported.
Each of the five fixed-sensor scenes contains 192 image/depth pairs, with depth rendered at the pose of its corresponding image. This replaces the earlier shared surface map, which could describe the wrong object pose. The reconstruction plane and registration issues remain separate requirements.
For frame , let be reconstructed depth and the reference depth sampled along the corresponding undistorted ray. Before object registration, the evaluated Euclidean error is:
The same translation is subtracted from the measured and reference points, so it cancels in their difference. A low error indicates agreement along the observed ray for that frame. Cross-frame registration needs its own evaluation.
The published reference depth is stored as unsigned 16-bit counts with a declared scale and offset to reduce transfer size. The reader also supports the 32-bit floating-point depth produced by the renderer. For a stored count :
The scale is model units per count. At 100 mm per model unit, that gives a depth increment of approximately 0.013 mm. This quantization belongs in the error budget, particularly when comparing small changes in root mean square error (RMSE). The decoded working array uses 32-bit floating point, so compact storage reduces transfer size without an equivalent reduction in working memory. Decoding does not recover precision lost during quantization.
Comparative evaluation
The following comparison used earlier captures to evaluate the change in color scoring. It predates the regenerated object motion and per-frame reference depths:
| Laser design | Earlier coverage / RMSE | Projection-score coverage / RMSE |
|---|---|---|
| 450 nm | 81.0% / 0.076 mm | 82.5% / 0.073 mm |
| 488 nm | 18.1% / 0.082 mm | 82.8% / 0.073 mm |
| 520 nm | Calibration failed | 82.5% / 0.071 mm |
| 660 nm | Calibration failed | 81.6% / 0.070 mm |
Color projection recovered usable scans at wavelengths where the earlier score failed. The calibration residual increased from 0.044 mm to 0.067–0.078 mm, since calibration uses the same detector. Improved scan coverage therefore came with a change in calibration quality. These measurements remain historical evidence for the color-score change; they do not establish accuracy for the regenerated moving-object sequence.
The moving-sensor rail run captured in the screenshots reported a shape error (RMSE) of 0.255 mm over 103,158 points under its selected settings. These are results from that run, not a general accuracy specification. The fixed-sensor sequence still needs a complete evaluation after its plane model and object registration are aligned with the captures. That evaluation must check image/depth pairing, reconstruction geometry, and agreement between registered frames together.
RMSE measures Euclidean error in millimeters over points with usable reference samples. Samples are excluded when neighboring depth values are missing or a large depth discontinuity makes interpolation unsuitable. The scored-point count is therefore needed alongside the error.
Coverage is:
counts reconstructed points with usable reference samples, while counts expected columns across all frames. A column is expected when the fitted laser plane crosses the reference surface within the working-depth range, whether or not a visible stripe was detected. Each column contributes at most one expected count per frame. This aggregate ratio estimates column coverage; it does not verify that every expected column was observed and cannot be read as surface-area coverage or defect-detection recall.
An earlier bottle example fell 8.5 percentage points short of full coverage. The aggregate ratio does not show where those gaps were or separate missed detections from unusable reference samples. For inspection, a low error elsewhere cannot compensate for an unobserved critical region. The bottle scattering model is also approximate, and its reconstruction target is the outer front surface, excluding the liquid interior. The dataset card describes the acquisition limits.
To compare algorithms, keep the captures fixed and vary one stage at a time: color score, center estimator, geometric band, learned gate, verification, or recovery. Record the capture revision, motion convention, image/depth pairing, and reference encoding, together with whether calibration was refitted and the PCA gate was enabled. Report error, scored and expected counts, missing regions, and total elapsed time together. The numerical tests cover specific cases; regenerated captures, unseen scenes, and physical materials each require their own evaluation.
Integration and further work
The implemented pipeline produces reconstructed geometry and diagnostics. For the regenerated moving-object captures, the next tasks are to match reconstruction to the fixed laser sheet and register the object poses. Defect classification, robot hand–eye calibration, calibrated per-point covariance, and an autonomous rescan policy remain future work.
A surface-inspection extension would register the cloud to a nominal model or fit a reference surface to trusted regions. For a point , reference point and unit reference normal , the signed normal deviation is:
This deviation could support detection of dents or excess material, provided registration error, local curvature, and missing coverage are accounted for. A mesh that visually fills a gap supplies no measurement evidence for that region.
Integration with a moving robot would also require synchronized acquisition poses and uncertainty propagation through both the ray–plane intersection and the frame transform. A first-order model is:
Here, contains image position and calibration parameters, is their covariance, and is the Jacobian of the reconstructed point with respect to those parameters. Propagating pose uncertainty would require including the pose parameters as well. The current heuristic search margin does not provide this covariance model.
A control interface would need to carry observation time, coordinate frame, calibration version, observed region, and qualification state with the points. Missing coverage or a measurement near a tolerance boundary could prompt another view; persistent ambiguity could be referred for review. These proposed behaviors still need evaluation against the timing and error requirements of the intended process.
In the lab, you can change an estimator, examine a difficult surface, and compare both the reconstructed geometry and the columns that remain unmeasured. Considering error and coverage together helps identify which stage needs further work and what evidence a practical inspection system would still need.
The screenshots document the lab runs discussed above. Separate light and dark captures let the page display the version that matches the reader's theme.
Need help? Discuss a project with Me.
References
The lab combines its own scanning pipeline with OpenCV for board detection, camera calibration, and board-pose estimation. The references below explain the underlying methods; they do not validate this implementation's accuracy.
- Steger, C. (1996). An unbiased detector of curvilinear structures. Technical Report FGBV–96–03, Technische Universität München. The directional Taylor step in the ridge estimator follows the principle described in this report. PDF
- Zhang, Z. (2000). A flexible new technique for camera calibration. A foundation for the planar camera-calibration method used through OpenCV. DOI
- Garrido-Jurado, S., Muñoz-Salinas, R., Madrid-Cuevas, F. J., & Marín-Jiménez, M. J. (2014). Automatic generation and detection of highly reliable fiducial markers under occlusion. This paper describes the ArUco fiducial-marker family used in the calibration board. DOI
- OpenCV. Detection of ChArUco Boards. Documentation for the combined chessboard–ArUco board and its corner-detection procedure. Documentation
- Huber, P. J. (1964). Robust estimation of a location parameter. The plane fit uses Huber weights in an iteratively reweighted least-squares scheme. DOI
- Jolliffe, I. T. (2002). Principal Component Analysis (2nd ed.). A general reference for PCA, which the lab applies to background-row modeling. DOI