A crack detector that only says a crack is present gives maintenance nothing to act on. What gets acted on is a width: 0.8 mm passes, 1.5 mm triggers repair. This walkthrough takes you from a raw image to a width in pixels and in millimetres, using the standard automated route: segment the crack, thin it to a one-pixel skeleton, compute the width from area and skeleton length, then convert with a calibrated mm-per-pixel scale. It is written for QA and asset-inspection engineers measuring cracks in concrete, coatings, welds and pavements, and it ends with the checks that make the number worth trusting.
What you need
Four things: a camera with enough pixels, a lens sized to the field, a light that separates crack from surface, and one object of known length in the crack's plane.
The pixel budget comes first. Decide the smallest width you must report and keep the pixel scale at or below one fifth of it: a 0.5 mm acceptance limit needs 0.1 mm/px or finer, so the narrowest reportable crack still spans 5 px. Mono sensors make segmentation easier, because crack contrast is grayscale information rather than a colour cast.
The MV-CS200-10UM is a mono, 20 MP camera on a 1" sensor with USB 3.0 and a C-mount.
- Sensor format
- 1"
- Lens mount
- C-mount
- Interface
- USB3
- Resolution
- 16-25 MP
Focal length then follows from the field of view and the working distance:
The lens focal length calculator runs the same arithmetic for your sensor. For a wide survey field, the LS-FFL-0567 is a 16 mm lens for 1.1" sensors, rated at 20 MP with an F2.8-22 aperture and under 0.3% distortion.
- Type
- Machine vision fixed
- Sensor format
- 1.1"
- Mount
- C-mount
- Resolution
- 16-25 MP
When the width itself is the measurand, a fixed-magnification telecentric lens removes the working-distance guesswork. The LS-TCL-0574 gives 0.4× magnification at a 227 mm working distance and covers a 1.2" sensor, so the object-space pixel size follows from the magnification and the sensor pitch alone — see calculating object-space pixel size from magnification.
- Sensor format
- 1.2"
- Mount
- C-mount
- Image circle
- 16-22 mm
Lighting decides whether the crack can be segmented at all. On an opaque surface, light it from the same side at a low angle: the flat surface reflects the light away and reads dark, while the crack walls scatter light back and read bright. The geometry options are set out in machine vision illumination types: choosing the right geometry. A crack that passes through thin sheet, glass or film is the easy case — a backlight silhouettes it. The LS-BKL-1468 is a flat backlight with a 150 × 150 mm lit area in red on 24 V.
- Size
- 100-200 mm
- Type
- Standard
- Voltage
- 24 V
Last, something of known length in the crack's plane: a ruler, a printed target, a machined edge. That is what turns pixels into millimetres.
Set the pixel scale before anything else
Every millimetre figure is only as good as this step. Image the known length in the same plane as the crack, at the same focus setting, with the camera square to the surface, then divide:
L is the known length in millimetres and n the pixel count that spans it; s is the scale every later number multiplies by. Image DPI metadata is not a scale, because it describes the file rather than your optics — see why image DPI alone cannot calibrate pixels to mm. For the full marker-based procedure, see camera calibration for length measurement from image markers.
Segment the crack cleanly
Threshold the image so the crack becomes one connected region on a black background, then clean it: remove specks below a few dozen pixels, close one-pixel gaps, and drop blobs whose shape looks nothing like a crack. Otsu's method on a well-lit grayscale image is a dependable default — automatic threshold segmentation with Otsu's method walks through it — and crack segmentation: separating cracks from noise covers the crack-specific cleanup.
Budget the threshold's own error. A blurred edge shifts the binary boundary by up to 1 px per side, so a measured width carries roughly ±2 px of uncertainty; at 0.05 mm/px that is ±0.1 mm. That is why the narrowest crack you quantify must span at least 5 px.
Compute the width: skeleton, area and the formula
Six steps, all on the calibrated frame:
- Acquire one frame with the geometry and lighting fixed above.
- Segment the crack to a binary mask.
- Thin the mask to a one-pixel skeleton (morphological thinning, often called skeletonization).
- Count the crack area A in px² — the pixel count of the mask. Measuring blob area by pixel counting shows the count.
- Count the skeleton length L_s in px. Weight diagonal steps as 1.41 px rather than 1, or a jagged crack reads longer than it is.
- Compute the width and convert it:
The estimator treats the crack as a band of near-constant width along its midline, the working assumption behind automated crack-width code. Where that assumption bends, two refinements cover it. For a tapering or branching crack, run the formula per branch, or read the local width from the distance transform instead:
D(p) is the Euclidean distance-transform value at skeleton pixel p — its distance in pixels to the nearest background pixel — so twice D(p) is the local width at that point. The median and maximum of w_local along the skeleton give you a width profile, not just one number. The same skeleton also yields crack length (L_s × s) and, between two imaging dates, crack growth; measuring crack endpoint distance and crack growth from image sequences cover both companions.
Worked example: a 30 px crack on a 200 mm field
Inputs, each one measured or specified:
- Pixel scale: a 50.0 mm target span covers 1,000 px, so s = 50.0 / 1,000 = 0.05 mm/px.
- Field check: at 0.05 mm/px a 4,000 px sensor row covers 4,000 × 0.05 = 200 mm, the width of a 12 MP, 4,000 × 3,000 px frame.
- Segmented crack: area A = 12,000 px², counted on the mask.
- Skeleton: length L_s = 800 px, diagonals weighted 1.41.
The rule in words: width is twice the crack area divided by its skeleton length, converted with the scale. The arithmetic:
The crack is 30 px wide and 1.5 mm wide in the part's own units; the ±2 px threshold uncertainty is ±0.1 mm, so quote 1.5 ± 0.1 mm. Decision: this asset's action limit is 0.5 mm, so the crack fails it by a factor of three and goes into the repair queue. Against a 2.0 mm monitoring limit the same measurement would be logged and re-imaged next quarter — either way, a number drives the call, not an adjective.
Check the number before you trust it
Three checks, in descending order of value.
- Artifact: image a pin or wire of known diameter — a 1.00 mm dowel pin, a feeler gauge blade — lying in the crack's plane, and run the identical pipeline. Require agreement within ±0.1 mm at 0.05 mm/px (±2 px) before trusting crack numbers from that set-up. It is the same logic inspectors apply when they measure a machined slot width with CMM and pin gauges.
- Profile: compare the area–skeleton mean against the distance-transform profile. A large gap between the two views means merged blobs, a broken skeleton or a stale scale — find which before shipping numbers.
- Scanlines: for a second opinion, count pixels across the crack along lines perpendicular to the local skeleton direction, the classic manual method, and take the median over the crack's length.
The artifact check validates scale, segmentation and formula as one chain. If it fails, work backwards through them in that order.
Common mistakes
- Calibrating from file DPI instead of an in-plane target — the largest single source of millimetre error.
- Target out of plane. Scale grows with distance, so a target 10% closer than the crack plane makes every width read about 10% low.
- Camera tilted off perpendicular. Apparent width grows as 1/cos θ: about 1.5% at 10°, 6% at 20°.
- One number for a branching network. The area–skeleton mean blends thick trunk and thin branches; report per branch or quote the profile distribution.
- Measuring below the 3 px floor. Report the crack as below the detection limit rather than quoting a width the pixels cannot support.
- Reusing a scale after any focus, aperture or lens change.
Where this leaves you
Width measurement is a chain — pixel scale, segmentation, skeleton arithmetic — and it breaks most often at the scale. Build it on hardware that holds its geometry: browse the cameras and lenses categories, size the field with the camera finder, or start at the configurator and work from sensor to light; the lights finder filters backlights by size and colour. More measurement methods sit on the systems topic page, and if a set-up resists all of the above, contact the applications team with an image attached — a width question is usually settled in one exchange.
Questions
What is the smallest crack width a given pixel scale can measure?
Keep 5 px as the working minimum and 3 px as the floor, because segmentation shifts the crack boundary by up to 1 px per side. At 0.05 mm/px that is a 0.25 mm practical minimum and a 0.15 mm absolute floor; below that, shorten the working distance or raise magnification instead of quoting the number.
Should I report the mean, the median or the maximum crack width?
Read the distance-transform profile along the skeleton, where twice the distance value at each skeleton pixel is the local width. Quote the median as the typical width, the maximum when a standard limits peak width, and the area–skeleton mean as a one-number summary. A tapering crack can peak at three times its median, so always say which statistic you are quoting.
How much does a tilted camera change the measured width?
Apparent width grows with 1 divided by the cosine of the tilt angle: about 1.5% at 10° and 6% at 20°. Keep the camera within roughly 10° of perpendicular, or use a fixed-magnification telecentric lens, which tolerates small distance and angle errors because its magnification does not depend on perspective.
How often does the mm-per-pixel scale need re-checking?
Re-shoot the target whenever focus, working distance, aperture or lens changes, and once per shift on a production line, because a bumped focus ring changes the scale silently. A fixed-magnification lens relaxes the schedule: its scale follows from the lens, so a daily target check catches drift.



