ApplicationsApplication note

Visual weld inspection with machine vision: pipes and fabrication

Size camera, lens and dark-field lighting for visual weld inspection with machine vision on pipe welds, with a worked field-of-view example.

LumaSpec Vision11 min read Share on LinkedIn

On this page 10 sections
  1. 01What the code asks and where the camera fits
  2. 02Three numbers set the station
  3. 03Worked example: 12 MP camera, 35 mm lens, 2 in pipe weld at 300 mm
  4. 04Light the cap with dark field, judge colour with diffuse
  5. 05Choosing camera and lens
  6. 06The parts for this station
  7. 07Pitfalls that cost weeks
  8. 08When the 2D answer is wrong
  9. 09Checks before you order
  10. 10Questions

Every power-piping weld passes a visual test before it ships. Today that test is an inspector, a flashlight and a memory of what acceptable looks like. A machine vision station repeats the surface part of that work at a fixed standard: it images each weld, flags undercut, porosity, spatter and cap-shape faults, and files the image with the joint number. This guide sizes such a station for a 2 in pipe weld. You get the field of view, the pixels per feature, the depth of field, a worked calculation at 300 mm working distance, the lighting geometry, and the parts that do the job.

What the code asks and where the camera fits

ASME B31.1 requires examination of production welds. Its examination chapter works this way: a weld is examined 100% by one of the volumetric or surface methods — radiographic, magnetic-particle, ultrasonic or liquid-penetrant — or by visual examination. Routine fabrication adds no hardness or impact testing of welds beyond what the job specification demands, and the material-specification tests such as chemistry and impact energy belong to the pipe manufacturer, not the fabricator. The fabricator's own duty is the examination of the welds it makes.

A camera station does not hold the acceptance authority; your certified inspector does. What the station adds is a fixed, repeatable view of every weld: same geometry, same exposure, same threshold. It flags the surface features the eye would catch, measures what the pixel scale allows, and archives the image against the joint number. That turns a spot-check into a complete surface record and frees the inspector for the calls that need judgement. Write that division of work into the inspection procedure before the first station goes live. If your job travels a UK PED route, the pipe weld inspection selection guide for PED fabrication maps the same code-to-instrument questions.

Three numbers set the station

Field of view, pixels per feature and depth of field decide everything else.

Field of view covers the cap plus sound base metal. Plan at least 8-10 mm of base metal beyond the cap toe on every side, because undercut and spatter land just off the toe.

Pixels per feature: three pixels across a feature is the detection floor; ten pixels is the measurement floor. Below three, a feature hides in noise; below ten, its measured size is not trustworthy.

Depth of field must swallow the cap height. The cap stands a few millimetres proud of the base metal, and the f-number decides whether toe and crown are sharp together. Depth of field scales linearly with f-number: F11 gives twice what F5.6 gives.

For a sensor of width W and a lens of focal length f at working distance WD:

m = f / (WD - f) FOV = W / m mm per pixel = FOV / pixels across the sensor DOF ≈ 2 × N × c × (1 + m) / m² (estimate)

Here m is magnification, N the f-number and c the blur circle, taken as about two pixels. The camera field of view and working distance guide shows the same geometry from the other direction, and the f-number and depth of field guide works the depth arithmetic in full.

How sensor width, working distance and field of view set the focal length Rays from the edges of the sensor pass through the lens and spread to the edges of the field of view. The ratio of sensor width to field of view is the magnification m.CameraField of view (FOV)Working distance (WD)≈ fsensor width slensm = s / FOVf = WD × m / (1 + m)
How sensor width, working distance and field of view set the focal length. Rays from the edges of the sensor pass through the lens and spread to the edges of the field of view. The ratio of sensor width to field of view is the magnification m.

Worked example: 12 MP camera, 35 mm lens, 2 in pipe weld at 300 mm

Inputs, each with its source:

  • Lens: LS-FFL-0679, a 35 mm C-mount machine vision lens (catalog).
  • Camera: LS-CMR-0166, a 12 MP USB3 model with 4000 × 3000 frames (catalog).
  • Sensor geometry: a 1/1.7 in format measures about 7.4 × 5.6 mm, 9.3 mm diagonal, and this lens class covers that diagonal with margin (standard format dimensions).
  • Working distance: 300 mm, the stand-off the station is built around.
  • Feature target: 0.2 mm, the undercut, porosity and spatter size the station must catch.
  • Cap width: 15-25 mm across on a 2 in (60.3 mm OD) pipe weld; 25 mm is the worst case here.

The rule in words: magnification is focal length divided by distance minus focal length; field of view is sensor width divided by magnification; millimetres per pixel is field divided by pixels; pixels on a defect is defect size divided by millimetres per pixel.

The arithmetic:

  • m = 35 / (300 - 35) = 35 / 265 = 0.132
  • FOV width = 7.4 / 0.132 = 56 mm; FOV height = 5.6 / 0.132 = 42 mm
  • mm per pixel = 56 / 4000 = 0.014 mm
  • pixels on a 0.2 mm defect = 0.2 / 0.014 = 14 pixels
  • margin around a worst-case 25 mm cap: (56 - 25) / 2 = 15 mm along the seam, (42 - 25) / 2 = 8.5 mm across it

Result: a 56 × 42 mm field at 0.014 mm per pixel, with 14 pixels on the 0.2 mm target.

Decision: the smallest detectable feature is 3 × 0.014 ≈ 0.04 mm and the smallest measurable one is 10 × 0.014 = 0.14 mm, so the 0.2 mm target clears both floors with margin — this geometry is measurement-grade for undercut, porosity and spatter. Pull back to 600 mm and the field roughly doubles: m = 35 / 565 = 0.062, FOV = 7.4 / 0.062 = 119 mm wide, 119 / 4000 = 0.03 mm per pixel, and the same defect spans 0.2 / 0.03 = 6.7 pixels — above the detection floor, below the measurement floor. Screen at 600 mm, measure at 300 mm.

Repeat the calculation with your own focal length and stand-off in the field of view calculator below.

Lens focal length, field of view and working distance
Units
Solve for
Focal length
– mm
Field of view
– mm
Working distance
– mm
Magnification
– x
Angle of view
– °
Pixel on the part
– mm

Thin-lens model: m = sensor width / field of view, f = WD × m / (1 + m). Accurate to a few percent above about 150 mm; check the lens's minimum object distance.

Find lenses with this focal length Open the full calculator

Light the cap with dark field, judge colour with diffuse

A weld cap is a raised, specular ridge on flat plate. Set bar lights at a low grazing angle, 20-30° above the surface, one on each side of the seam, and the geometry does the sorting: flat base metal mirrors the light away and stays dark, while undercut grooves, porosity pits, cap ripples and spatter beads scatter light up into the lens and glow. That dark-field set-up is the fastest way to make surface faults stand out without image processing. The light geometry selection guide walks the same choice for other surfaces.

Bright-field and dark-field lighting geometry High-angle light reflects off the flat surface straight into the lens, so the surface looks bright. Low-angle light reflects away from the lens, so the surface looks dark and only edges or scratches scatter light upward.flat part with a scratchCamerabright field(high angle)dark field (low angle)flat areas reflect away;only the scratch sends light up
Bright-field and dark-field lighting geometry. High-angle light reflects off the flat surface straight into the lens, so the surface looks bright. Low-angle light reflects away from the lens, so the surface looks dark and only edges or scratches scatter light upward.

Keep a diffuse white source in the cell as well. Flat, even illumination shows heat tint, grinding marks and cap shape the way a hand lamp would, which is what colour and appearance calls need — and it is the cure when mill scale texture mimics porosity under grazing light. For the same fight inside a tube, the pipe internal glare guide covers the lighting from the bore side.

Two shop-floor realities shape the wiring. Arc flash: gate the exposure on the weld controller's end-of-weld signal so the arc is out before the shutter opens. Ambient light: a bandpass filter matched to the LED wavelength restores contrast in a bright shop, as the bandpass filter guide shows. Drive the bars from a strobed controller and keep exposures short rather than stacking long continuous-light frames.

For this station the high-luminance LS-BAR-0400 (312 × 30 mm) takes the dark-field role, the diffused white LS-BAR-1276 (372 × 28 mm) takes the even-surface role, and the LS-BAR-1047 (290 × 30 mm) lights the far side of the seam.

Choosing camera and lens

Shutter first. A rolling shutter reads the sensor line by line, so the part must hold still during the exposure — which an indexed weld station already does. Welds that arrive on a moving line want a global shutter model or line scan: filter the camera finder by shutter type, and the line scan weld seam inspection guide covers the continuous-motion route.

Mono or colour: mono maximises geometric contrast; colour earns its keep when heat tint and burn marks carry information.

Interface: USB3 suits a station beside the PC; GigE crosses a cell or a line without extra hardware.

Lens checks: the image circle must cover the sensor diagonal — an 11 mm circle over a 9.3 mm diagonal leaves margin — and the mounts must match. Resolution at this scale: at the 0.132 magnification of the worked example, a 6 MP-class lens resolves roughly 150 line pairs per millimetre at the sensor, about 50 µm per pair on the part, an order below the 0.2 mm target, so the lens is not the limit here. Focus at the working distance with the part in place; when focus will not reach, the C-mount flange distance and shim guide explains the fix. Browse by focal length and image circle in the machine vision lenses category.

The parts for this station

The worked example maps onto catalog parts: the camera sets the pixel scale, the lens sets the field, the bars set the contrast between fault and base metal:

Area scan cameras12 MP USB3 area scan camera, IMX226, 1/1.7" rolling shutter, 30 fps, 4000 × 3000 resolution (LS-CMR-0166)LS-CMR-0166
Sensor format
1/1.7"
Interface
USB3
Resolution
12 MP
Shutter
Rolling
$560.00View partBuild a system with it
Machine vision lenses35 mm, 2/3", 6 MP, C-mount machine vision lens (LS-FFL-0679)LS-FFL-0679
Type
Machine vision fixed
Sensor format
2/3"
Mount
C-mount
Resolution
6-10 MP
$219.00View partBuild a system with it
Bar lights312 x 30 mm High luminance bar light (LS-BAR-0400)LS-BAR-0400
Size
200-400 mm
Type
Standard
$459.00View part
Bar lightsBar light, 372 x 28 mm, White (LS-BAR-1276)LS-BAR-1276
Size
200-400 mm
Type
Diffused
$439.00View part
Bar lights290 x 30 mm LED bar light (LS-BAR-1047)LS-BAR-1047
Size
200-400 mm
Type
Standard
$449.00View part

Start from the camera configurator step or the lighting step to match mounts, cable and controller. The wider area scan cameras range and the bar light list above hold the alternatives. For the buying decision as a whole, the machine vision parts inspection selection guide compares resolution, throughput and integration options side by side.

Pitfalls that cost weeks

Motion blur comes first. At 0.014 mm per pixel, a pipe drifting at 300 mm/s under a 1 ms exposure smears the image by 300 × 0.001 = 0.3 mm — about 21 pixels — and every edge goes soft. Holding blur to one pixel at that speed needs an exposure of 0.014 / 300 s ≈ 47 µs, which is strobe territory; indexing the pipe to a stop is simpler and costs nothing.

Focus with the part in place. A station sharp on a flat target and soft on the weld is a focus-position or flange-distance error, and the shim guide above sorts it in minutes.

Mill scale and grinding marks look like porosity under the wrong light. Raise the light angle or add the diffuse bar and the texture fades while true pits keep their shadow; the robust lighting guide explains why contrast, not brightness, carries the call.

Calibrate the scale, not only the focus. Image a ruled gauge at the working distance each shift and tie millimetres to pixels — the pixel-width distance method doubles as a two-minute cross-check that catches a bumped mount.

Heat haze shimmers long beam paths; the 600 mm screening position is usually clear, but keep the sightline out of exhaust plumes and cooling-fan wash.

When the 2D answer is wrong

Three cases need different tools. Cap height and reinforcement are 3D quantities that a grey image judges by shading alone; if the job wants reinforcement measured to a tenth of a millimetre, a laser profilometer reads it directly, and the 3D versus 2D decision guide lays out the trade.

The root side and the bore never show to an outside camera. Inside-diameter welds take 360° bore optics or a travelling probe; the 360° bore inspection lens guide covers the optics, and the glare guide above covers the light fight inside the tube.

A continuously rotating or travelling weld wants line scan: one continuous image per revolution, no indexing pauses. The line scan weld seam guide linked above walks that set-up end to end.

Checks before you order

  • Field: at your worst-case joint, (FOV − cap) / 2 leaves at least 8-10 mm of base metal on every side.
  • Pixels: the smallest feature on your acceptance sheet spans at least 10 pixels at the chosen stand-off.
  • Depth of field at the working f-number exceeds the cap height; one stop down doubles it.
  • Bars: lit length exceeds the field with mounting margin, sitting 20-30° from the surface and clear of the lens.
  • Trigger: an end-of-weld signal or photoeye exists in the cell, and the arc is out before the exposure opens.
  • Interface: USB3 for bench-length runs, GigE for the long haul to the cell.
  • Mount: the stand ties to the frame, and the ruled-gauge check is part of the shift routine.

Take the joint drawing and the smallest defect on the acceptance sheet to the quote desk or the contact page, and more bench set-ups like this sit on the applications topic page.

Questions

Does a machine vision system replace the code-required visual examination?

No. ASME B31.1 places visual examination with qualified inspection personnel, and the acceptance call stays theirs. The camera station gives them a fixed, repeatable view: it images every weld, flags suspect surface features, and files the image against the joint number. Write that division of work into your inspection procedure so the record shows who accepted each weld.

How many pixels do I need across a weld defect?

Use three pixels as the detection floor and ten as the measurement floor. The 4000-pixel camera in the worked example reads 0.014 mm per pixel, so a 0.2 mm undercut spans 14 pixels and measures cleanly. A 5 MP, 2/3 in model over the same geometry gives a wider 67 mm field and about 8 pixels on the same defect: enough to flag it, marginal for sizing.

Can one camera cover the full circumference of a pipe weld?

Not in one shot with a 56 × 42 mm field; it sees one sector of the seam. Index the pipe under fixed optics in three or four shots, mount cameras around the station on high-volume lines, or rotate the pipe continuously under a line scan camera. The indexing route keeps the measurement-grade pixel scale; continuous rotation usually trades some of it for cycle time.

What light colour suits weld surface inspection?

White suits colour judgement: heat tint, burn marks and coating damage carry colour information that a monochrome light destroys. Red suits geometric surface calls such as undercut, porosity and spatter on grey steel: high contrast, and it pairs naturally with a matched bandpass filter that shuts out shop and arc light. Blue sits between: strong contrast with less heat-tint confusion on oxidised surfaces.

Does the same set-up work on 3 in and 4 in pipe?

Yes, once the margin is checked. The 42 mm field height covers caps up to about 30 mm with 6 mm of base metal left on the tight side, which spans most 4 in welds; the 56 mm width gives 13 mm there. Larger fabrications move the camera back: every doubling of working distance roughly doubles the field and halves the pixels per millimetre.