Cameras & sensorsExplainer

Pixels per defect: sizing a camera for crack detection

Turn crack width into pixels per defect: the 3 px floor and 10 px target, the field-of-view math, lens and lighting choices, and when to split the view.

LumaSpec Vision12 min read Share on LinkedIn

On this page 9 sections
  1. 01How many pixels does a crack need across its width?
  2. 02How do you convert crack width into pixels per defect?
  3. 03How large a field of view can one camera cover and still see the crack?
  4. 04Does a higher megapixel sensor help if you record 1080p video?
  5. 05What lighting makes those pixels actually show the crack?
  6. 06Which camera and lens do you pick for a few square centimeters of plastic?
  7. 07When is one camera the wrong answer?
  8. 08What do you check before you order the camera?
  9. 09Questions

A 5 MP camera either solves your crack problem or wastes a station, and the megapixel count alone cannot tell you which. What decides it is pixels per defect: how many sensor pixels span the finest crack width on your plastic part, at the field of view the station needs. Work that one number out and the rest follows — sensor resolution, lens magnification, working distance, covered area, and whether one camera is enough or the part must be split across stations. This guide gives you the pixel rule for cracks, the conversion formulas, a worked example that runs from a 0.05 mm hairline to a concrete camera-and-lens pick, and the lighting that makes those pixels visible.

How many pixels does a crack need across its width?

A crack you must find automatically needs at least 3 pixels across its width, and 10 pixels is the target that survives focus error, threshold noise and part-to-part variation, so every sizing decision downstream starts from the finest crack width on your part.

At 3 pixels the crack is a short chain of intensity steps. One noisy pixel breaks the chain, focus error spreads the line into the background, and the lens blurs it by another pixel or more on each side. The floor therefore assumes sharp focus, a short exposure and clean contrast; relax any of those and the crack drops below threshold.

At 10 pixels the line has shape. You can follow branches, tell a crack apart from a scratch or a dust fiber, and reject threshold jitter with simple morphology. That is why automated crack detection gets specified at 8-10 pixels per defect, while a human reviewer can still work with 3.

The count also trades directly against covered area: at a fixed sensor, doubling pixels per defect halves the field of view. The same trade drives the pixel rule for sizing defect-detection resolution, so the honest sizing question is never 'how many megapixels' but 'how many pixels across the finest crack, over how many millimeters'.

How do you convert crack width into pixels per defect?

Pixels per defect is crack width divided by the size of one pixel on the part, so a 0.05 mm crack under a 5 µm object-space pixel spans 10 pixels, while the same crack under 75 µm pixels spans less than one and is gone.

pixels per defect = crack width / object-space pixel size object-space pixel size = field of view width / sensor pixels across object-space pixel size = sensor pixel pitch / lens magnification max field of view = crack width × sensor pixels across / pixels-per-defect target

Object-space pixel size is one sensor pixel projected onto the part. You can get it from the field of view and pixel count alone — no lens data needed — or from pixel pitch and magnification; the object-space pixel size calculation walks through the second route in detail.

Run the formulas in both directions. To hold 10 pixels on a 0.5 mm crack, a 4,000-pixel sensor caps the field at 0.5 mm × 4,000 ÷ 10 = 200 mm; the same sensor chasing a 0.05 mm hairline caps at 20 mm. And to read pixels per defect off an existing set-up, divide the measured field by the pixel count, then the crack width by that result.

How large a field of view can one camera cover and still see the crack?

Multiply the finest crack width by the sensor's pixel count and divide by the target: 0.05 mm × 4,000 pixels ÷ 10 gives a 20 mm field at the robust target, or 67 mm at the 3 px floor, on a 4,000-pixel camera.

Worked example, start to finish. Part: a plastic trim clip with a finest visible crack of 0.05 mm. Camera: 4,000 × 3,000 pixels, the 12 MP class.

  • Field of view at the 10 px target: 0.05 mm × 4,000 ÷ 10 = 20 mm.
  • Object-space pixel at that field: 20,000 µm ÷ 4,000 = 5.0 µm.
  • Reach at the 3 px floor: 3 × 5.0 = 15 µm, so cracks down to 0.015 mm stay detectable.
  • A 0.5 mm crack at the same field spans 500 ÷ 5.0 = 100 pixels — easily classified, even measurable.

To deliver a 20 mm field on a 1/1.7-inch sensor (about 7.4 mm wide), magnification must be 7.4 ÷ 20 = 0.37×. A 0.4× fixed-magnification lens lands close: field 7.4 ÷ 0.4 = 18.5 mm wide by 13.8 mm high, about 2.6 cm² of part, object pixel 18,500 ÷ 4,000 = 4.6 µm, and the crack spans 50 ÷ 4.6 = 10.8 pixels. A few square centimeters per station is exactly what a 4,000-pixel sensor buys at the 10 px target.

Now point the same camera at the whole 300 mm part. Object pixel: 300,000 ÷ 4,000 = 75 µm. The hairline spans 50 ÷ 75 = 0.7 pixels — invisible. Even the 0.5 mm crack spans 500 ÷ 75 = 6.7 pixels, which passes a human glance and fails an automated check. One camera cannot do both jobs; the field of view, not the megapixel badge, sets the limit.

Check your own part against the calculator:

Camera resolution for the smallest feature
Units
Pixels needed
–
Sensor size
– MP
Smallest sensor that fits
–
Pixel on the part
– mm
Pixels across the feature, that sensor
–

Pixels needed = field / feature × pixels per feature on each axis (field incl. margin). The lens must resolve the pixels too: Nyquist = 1000 / (2 × pixel µm) lp/mm.

Find cameras with enough pixels Open the full calculator

Does a higher megapixel sensor help if you record 1080p video?

It does not: pixels per defect come from the image the detector receives, so a 1,920 × 1,080 recording delivers the same count whether the sensor behind it is 5, 8 or 12 MP — capture stills or a full-resolution region of interest instead.

At 1,920 pixels across, the 300 mm field works out to 300,000 ÷ 1,920 = 156 µm per pixel, and the 0.05 mm crack spans 0.3 pixels. Even at the 20 mm field of the worked example, 1080p gives 20,000 ÷ 1,920 = 10.4 µm per pixel and 4.8 pixels on the crack — above the floor, well below the target.

Read the same sensor at full resolution and the same 20 mm field delivers 5.0 µm per pixel and 10 pixels on the crack. Nothing about the optics changed; the readout mode did. Treat a 1080p mode as a preview and set the inspection capture to full sensor resolution, or to a full-resolution region of interest over the crack-prone zone. Some cameras only reach their top frame rates in reduced-resolution modes — the sensor resolution modes behind a 4K USB stream explains that trade and how to get the full pixel count back.

What lighting makes those pixels actually show the crack?

Resolution puts pixels over the crack, but lighting decides whether those pixels cross your threshold, and on matte plastic a low-angle or dark-field bar light turns the crack into a bright line on a dark part while diffuse top light can hide it completely.

Cracks are geometry, so light them by geometry. Two bar lights at roughly 30-60° from the part plane, camera looking straight down: the flat surface reflects the light away and reads dark, the crack walls scatter light back to the sensor and read bright. The crack lighting guide for white plastic cylinders shows this set-up on exactly that part family, and the lighting angle and wavelength mapped by defect guide extends it to other defect types.

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.

Diffuse bright field works only for open cracks that cast a real shadow; hairlines on matte plastic wash out under it. Glossy parts add specular glare that drowns a one-pixel line, which is where cross-polarization earns its keep — polarizer on the light, analyzer on the lens, rotated to extinction.

Judge the result on the delivered pixels: crack line and background should span most of the 8-bit range, not ten gray levels of difference. The why adequate contrast is not enough guide covers the margin that survives production variation, and lighting geometry for image contrast covers the positions that create it.

Which camera and lens do you pick for a few square centimeters of plastic?

For a 0.05 mm crack the worked example lands on a 4,000-pixel USB3 camera at 0.4× fixed magnification covering an 18.5 mm field with the crack at 10.8 pixels, and on a 20 MP, 1-inch-sensor camera when the station must cover more part or finer cracks.

Finest crack Object pixel at 10 px Field on 4,000 pixels Station
0.02 mm 2 µm 8 mm High magnification, staged
0.05 mm 5 µm 20 mm One 12 MP station
0.1 mm 10 µm 40 mm One 12-20 MP station
0.5 mm 50 µm 200 mm One 20 MP station, wide field

Full resolution at 30 fps moves 4,000 × 3,000 × 30 = 360 MB/s of 8-bit data. USB3 carries that; a GigE link caps near 110 MB/s, about 9 frames per second at this frame size. The LS-CMR-0166 is a 12 MP USB3 area scan camera. Its 4,000 × 3,000 resolution at 30 fps is exactly the worked example.

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

The fixed-magnification route keeps the numbers honest from station to station. The LS-TCL-0574 is a 0.4× fixed-magnification lens with a 227 mm working distance and a 1.2-inch image circle. On the 1/1.7-inch sensor of the worked example it leaves margin on every side.

Machine vision lensesFixed-magnification lens, 0.4x, 227 mm WD, 1.2" (LS-TCL-0574)LS-TCL-0574
Sensor format
1.2"
Mount
C-mount
Image circle
16-22 mm
$2,269.00View partBuild a system with it

When the crack spec widens to 0.1 mm, or the station must cover more part, a 20 MP 1-inch sensor roughly doubles the pixel count. At 20 MP that format runs about 2.4 µm pixels, which at 0.4× magnification land as 6.0 µm object pixels: the 0.05 mm hairline spans 8.3 pixels and a 0.1 mm crack spans 16.6. At 0.5× the object pixel drops to 4.8 µm and the hairline reaches 10.4 pixels over a field of about 26 mm. The MV-CS200-10GC is a 20 MP GigE camera on a 1-inch sensor with a C-mount.

Area scan camerasHikrobot MV-CS200-10GC 20 MP Area Scan Camera, GigE, IMX183, Color, BasicMV-CS200-10GC
Sensor format
1"
Lens mount
C-mount
Interface
GigE
Resolution
16-25 MP
$739.00View partBuild a system with it

A 20 MP sensor needs a lens that can feed it. Nyquist for 2.4 µm pixels is 1 ÷ (2 × 0.0024 mm) ≈ 208 line pairs per millimeter, and a lens rated for 5 MP softens the crack line before the sensor ever sees it. The Nyquist limit and camera resolution guide covers the matching and lens contrast and resolution covers reading the curves; the machine vision lenses finder filters by format and resolution rating. The LS-FFL-0567 is a 16 mm lens rated for 20 MP sensors up to the 1.1" format, with F2.8-22 and under 0.3% distortion.

Machine vision lenses16 mm, 1.1", 20 MP, C-mount machine vision lens, F2.8-22, <0.3% distortion (LS-FFL-0567)LS-FFL-0567
Type
Machine vision fixed
Sensor format
1.1"
Mount
C-mount
Resolution
16-25 MP
$679.00View partBuild a system with it

Stay near wide open on hairline work. Diffraction blur diameter is about 2.44 × 0.55 µm × f-number: f/4 blurs roughly 5.4 µm, two pixels on a 2.4 µm sensor, while f/8 blurs 10.8 µm and can sink a 3 px crack. Stop down only when depth of field forces it, and re-run the pixel count at the aperture you settle on.

When is one camera the wrong answer?

When the finest crack and the whole part cannot share one field of view — a 0.02 mm crack needs 2 µm object pixels, which caps a 4,000-pixel sensor at an 8 mm field — you stage the inspection or move the camera instead of chasing megapixels.

The arithmetic makes the point: a 200 mm part at 8 mm per station is 25 camera positions. That is occasionally justified and rarely budgeted. The practical moves:

  • Stage the part. One coarse station checks presence and gross damage over the whole part; one or two crack stations image the known stress zones at 0.4× or better.
  • Move the camera, not the part. A camera on a gantry re-uses one calibrated high-magnification position across many part positions, and each capture still obeys the same pixel rule.
  • Go line scan on long parts. A 2,000- or 4,000-pixel line scan sensor with a belt encoder covers meters at a fixed µm-per-pixel; the same 3 px floor and 10 px target apply to its cross-track pixels.
  • Split by defect type. Low-magnification presence checks and high-magnification crack checks want different lighting; separate stations keep each light simple. The scratch detection guide with dynamic thresholding shows the high-magnification end of that split.

What do you check before you order the camera?

Confirm four numbers end to end: the finest crack width in millimeters, the pixels per defect it yields at your chosen field of view, the lens resolution rating at that pixel pitch, and a lighting trial that shows the crack in a full-resolution live image.

  • Crack width, measured. A stereo microscope with a stage micrometer turns 'hairline' into a number; 0.02 mm versus 0.05 mm moves the field of view by 2.5×.
  • Pixels per defect at the real field. 10 px target, 3 px floor — at the worked example's field that is 5.0 µm pixels and a 15 µm reach.
  • Lens matched to pixels. Image circle at or above the sensor format, resolution rating at or above the sensor's Nyquist (208 line pairs per millimeter for 2.4 µm pixels), fixed magnification where stations repeat.
  • Exposure and diffraction. f/2.8-f/4 for 2-3 µm pixels, blur under two pixels, depth of field checked across the part height.
  • Data link and host. 12 MP at 30 fps is 360 MB/s: USB3 rather than GigE at full rate, and a host that swallows the stream plus the detection load.

Size the camera first, then the lens, then the light — in that order, because each step constrains the next. The configurator walks the same sequence:

Build the whole station

The configurator matches a camera, lens, light, light controller and cables to each other, step by step, and lists only parts that fit what you already picked.

Start with the camera

If your fixture geometry fights the numbers — curved parts, tight enclosures, a moving line — the contact page gets you an applications engineer looking at the actual part.

Questions

Do you need a global shutter camera to catch cracks?

Only if the part moves during exposure. A rolling shutter reads the sensor line by line, so a moving part comes out skewed; a stationary part on a fixture has no skew, and either shutter works. For parts on a belt or a robot arm, pick a global shutter model or strobe the light so the exposure itself freezes the motion.

Mono or color: which sensor finds cracks better?

Mono. A color sensor interpolates every pixel from a Bayer pattern, which softens edges and wastes resolution exactly where a hairline crack cannot afford it. A mono sensor gives sharper lines and better sensitivity. Choose color only when the defect itself is a color change, such as staining, burns or discolored resin, rather than a geometry change.

Can sub-pixel edge algorithms replace the pixel count?

No. Sub-pixel methods refine a width measurement after the crack is detected, and published systems reach well below one pixel of measurement error under good contrast. They cannot create information: a crack spanning half a pixel has no edge to refine, so it stays undetectable no matter which algorithm you run. Size the optics for detection first, then measure.

How do you confirm pixels per defect before buying anything?

Shoot a ruler. Fix the camera and lens at the working distance, photograph a steel ruler, and count the pixels between two known millimeter marks. Divide distance by pixels for the object-space pixel size, then divide crack width by that number. A 0.05 mm crack with 4.6 µm pixels lands at 10.8 pixels, so one bench photo settles the question.

What exposure keeps a moving part sharp enough for crack detection?

Limit blur to one object-space pixel: exposure time equals pixel size divided by part speed. With 5 µm pixels and a part moving at 100 mm/s that is 50 µs, which needs a strobed or high-intensity light. At a 1 ms exposure the same part blurs 0.1 mm, about 20 pixels, and the crack is gone.