Some original image labels are retained; figure captions and explanations are provided in English.

PART III · MEASUREMENT · Metrology

Measuring from Images: Pixels, Millimeters and Measurement Uncertainty

A bore-diameter example follows the measurement chain from a reference length and pixel-to-millimetre scale to edge selection and circle fitting. The article examines fixed-scale assumptions, subpixel localisation and the consequences of choosing a circle, ellipse or line model. Repeatability, Gauge R&R, traceable records and acceptance decisions near tolerance limits complete the workflow.

Article sectionsHow are pixels converted to millimeters?Accuracy, repeatability and uncertainty in image-based measurementCase study: measuring the hole diameter of a metal partWhich assumptions support pixel-to-millimeter conversion?Understanding measurement system analysis (MSA)What records support reliable acceptance decisions?How should measurements near tolerance limits be handled?What do circle, ellipse and line fits actually measure?Frequently asked questions

How are pixels converted to millimeters?

The simplest approach is to measure how many pixels span a reference of known physical width in the working plane. If an 80 mm reference occupies 1,200 pixels, the approximate scale is 80/1200 = 0.0667 mm/pixel. An edge spanning 240 pixels then measures 240 × 0.0667 ≈ 16.0 mm at that scale.

This calculation is valid only in the same plane, with suitable geometry and an approximately constant scale. Perspective and distortion can make scale vary across the image. Establishing scale from one known part is not equivalent to calibrating the entire field.

Intensity-edge transition and subpixel localization
FIGURE Mathematical illustration of estimating an intensity edge from noisy pixel samples.

An edge is not an infinitely thin mathematical line occupying one pixel. Optical blur and sensor sampling typically spread its intensity transition across several pixels. Subpixel edge estimation uses that transition to estimate positions more finely than the pixel grid. Resolving a position to 0.1 pixel does not automatically reduce physical measurement error to 0.1 pixel: systematic distortion, mounting and reference errors can remain.

The calculator converts lengths using a supplied scale; it is not, by itself, calibration validation or a measurement certificate. Production acceptance values require independent verification.

Accuracy, repeatability and uncertainty in image-based measurement

Consistent repeated results are valuable but insufficient. A system that always reads 0.15 mm too high can be highly repeatable while inaccurate. Evaluate accuracy relative to a reference, repeatability, reproducibility, stability and uncertainty separately. NIST's measurement-process characterization guidance explains why these distinctions matter in production measurement systems. NIST measurement-process guidance.

Suppose the diameter tolerance is 16.00 ± 0.10 mm. A 16.08 mm reading appears within tolerance. But if expanded measurement uncertainty is, for example, ±0.05 mm, deciding whether the part truly exceeds the limit requires an explicit decision rule. Acceptance and rejection rules must be agreed together with the uncertainty budget and quality procedure. A simple threshold comparison is not always sufficient.

Where does measurement uncertainty come from?

  • Optical contributions: distortion, focus, depth of field, lens behavior and reflections.
  • Image-processing contributions: segmentation thresholds, edge models, interpolation and ROI selection.
  • Mechanical contributions: part height, vibration, fixture repeatability and thermal variation.
  • Calibration contributions: reference dimensions, target poses, model fit and lack of independent validation.
  • Process contributions: shifts, operators, maintenance, reinstallation and lighting aging.

Independent standard uncertainty contributions may be combined using a root-sum-of-squares calculation. However, this relies on the independence of the relevant contributions; shared systematic effects do not disappear. Explain how every contribution in the uncertainty budget was estimated.

Measurement system analysis: why does Gauge R&R matter?

Repeatability examines repeated measurements of the same part under the same conditions. Reproducibility examines differences between operators, cameras, fixtures or operating conditions. A system may measure one bench sample consistently yet shift by 0.2 mm after a fixture change. NIST's Gauge R&R framework is a useful starting point for examining production measurement variability. NIST Gauge R&R.

Case study: measuring the hole diameter of a metal part

Consider inspecting a metal housing's central hole. Its nominal CAD diameter is 16.00 mm with a ±0.10 mm tolerance. The part lies horizontally in a fixture under an overhead camera. The field of view is approximately 80 mm and that image axis contains 1,200 pixels. These are illustrative example values, not guaranteed performance specifications for an actual system.

First obtain enough contrast to separate the external surface from the internal hole. If the hole is dark and the top face bright, seek stable edges despite local reflections. Select reliable points around the center for circle fitting. Correct pose if the part is tilted and use calibration where lens distortion matters. Suppose the fitted diameter is 241 pixels. Under the stated scale assumption, 241 × 80/1200 = 16.067 mm is the resulting diameter.

A result inside tolerance does not yet establish acceptance. Examine systematic error and repeatability on parts measured with an independent reference instrument. Also test changes in height, gloss and camera-to-part distance. Real systems need an uncertainty-aware decision rule for parts near tolerance boundaries.

The engineering lesson: Displaying 16.067 mm does not automatically demonstrate 0.001 mm accuracy. The number of decimal places on screen differs from a measurement system's physical capability.

Which assumptions support pixel-to-millimeter conversion?

A simple scale calculation assumes the object and reference share a measurement plane and geometric conditions. Perspective, height variation or strong distortion can invalidate a single millimeter-per-pixel factor across the image. Planar transformations, local calibration or telecentric optics may then be appropriate.

WORKED EXAMPLE · ILLUSTRATIVE
Reference length: 1200 pixels = 80 mm

Scale 80/1200 = 0.06667 mm/pixel. An edge spanning 241 pixels gives 241×0.06667 ≈ 16.07 mm, apparently within a nominal 16.00 ± 0.10 mm tolerance. With an assumed uncertainty of 0.03 mm, however, unconditional guaranteed acceptance may be inappropriate. Define the organization's decision rule and guard-band policy in advance.

Why does subpixel localization not always imply high accuracy?

Estimating edge position from an intensity profile can improve resolution and repeatability. Yet blur, illumination angle, threshold definition and optical transfer can shift the physical edge represented. A 0.1-pixel resolution is therefore not the same as 0.1-pixel accuracy. Define the physical measurand first: for example, which chamfer boundary defines the hole diameter?

Understanding measurement system analysis (MSA)

When evaluating measurements, distinguish repeatability (variation within one system under similar conditions), reproducibility (variation between operators or setups), bias and stability. Include camera temperature, fixture position, illumination level and part height in comparisons.

Gauge R&R can help distinguish measurement-system variation from genuine dimensional differences between parts. Numerical acceptance criteria depend on the application and industry procedure: one universal percentage is not appropriate for every system.

Error sourceSymptomCheck
Perspective or heightMeasurements change with part position or heightCalibration plane; telecentric optics
Focus or sharpnessSoft edges and unstable thresholdsDepth of field, MTF and fixed working distance
IlluminationBoundary shifts between production shiftsFixed lighting geometry; reference images
Software decisionResults jump after filter or ROI changesParameter versioning and regression tests

What records support reliable acceptance decisions?

Where diameter or distance measurements directly affect production, record their acquisition conditions as carefully as their values. Trace camera and lens settings, calibration version, threshold or edge parameters, part serial number and timestamp. When measurements drift during a shift, this allows comparison of the conditions behind the decision, not only final pass/fail results.

The physical chain from image to measurementUncertainty can enter at every stage Partsurface / positionOpticsfocus / blurEdgealgorithm choiceCalibrationmm/px / geometryTolerancedecision rule Low reprojection error or high pixel resolution alone does not establish accuracy.
FIGURE Stages of geometric measurement where systematic and random effects can arise.

How should measurements near tolerance limits be handled?

Measurement uncertainty characterizes the range of values reasonably attributable to a measurement result. Reporting a single number near a tolerance limit can hide false-accept and false-reject risks. Define guard bands, rejection or remeasurement conditions and handling of ambiguous products in advance. Products with different risk levels need not share the same decision rule.

Reprocessing one photograph repeatedly is not equivalent to repositioning and reimaging the part. The former tests numerical software repeatability; the latter better exposes actual mechanical, optical and lighting variability.

What do circle, ellipse and line fits actually measure?

An elliptical hole image does not necessarily indicate a physically elliptical hole. Perspective can make a circular edge appear oblique. Circle fitting may suit a plane perpendicular to the camera, while an oblique plane can require geometric correction first. Partial occlusion makes model selection more critical.

Measurements also depend on the edge model. With external burrs, taking the maximum contour diameter may not match the accepted diameter definition. Least-squares fitting is sensitive to outliers; robust fitting or selected arc regions may be necessary. Before using a more complex fit, establish exactly which drawing dimension is being inspected.

How should an uncertainty budget be organized?

Record reference-length calibration, edge localization, lens distortion, height variation and repositioning contributions separately. Do not conflate random and systematic effects. Combined standard uncertainty can be calculated when independence and distribution assumptions are justified; blindly taking a sum of squares can otherwise mislead. Report the method, uncertainty approach and decision rule with the result.

Pixel-to-millimeter calculator

Calculating…

Use only for a common measurement plane with a valid constant-scale assumption. This is not a metrological conformity decision.

Frequently asked questions

Is calibration required to convert pixels to millimeters?

A controlled planar reference can establish scale. Variable perspective, distortion or demanding measurement conditions require more comprehensive calibration.

Is subpixel measurement always accurate?

No. The repeatability of subpixel localization differs from physical measurement accuracy.

Is Gauge R&R only for contact instruments?

No. Measurements produced by cameras and software can also undergo measurement system analysis.

Technical references

This article combines explanations supported by technical references with educational numerical examples. The example system values are not measurements from an actual facility.