Feature size
Define the smallest defect, edge or code element that must be detected or measured reliably.
Knowledge · Fundamentals
The smallest relevant detail, the available installation space and the lens determine how many sensor pixels are useful for the inspection.

Decision
Resolution only matters once you know how many pixels you want across the smallest critical feature width, and whether lighting and motion keep those pixels usable.
Define the smallest defect, edge or code element that must be detected or measured reliably.
Define an initial number of pixels across the feature, then validate it with the selected optics, contrast and inspection tool. No universal pixel count guarantees detection or measurement accuracy.
FOV must cover the part (plus margin) at the available WD. Lens + sensor size close that triangle.
Approach
The following values are illustrative design inputs, not a tested camera recommendation. Assume a 0.2 mm feature, an initial target of four pixels across it and a 120 mm horizontal field including positioning margin. Validate the four-pixel assumption with actual contrast and the inspection algorithm.
Required horizontal pixels = field width × pixels per feature ÷ feature width = 120 × 4 ÷ 0.2 = 2,400 pixels. A hypothetical 2,448-pixel-wide image gives 20.4 pixels/mm, or 4.08 pixels across the 0.2 mm feature. A 1,920-pixel image at the same field gives 3.2 pixels. Neither value alone proves detection; this calculation screens candidate image formats.
Assume an active sensor width of 8.8 mm. Required magnification m = 8.8 ÷ 120 = 0.0733. For a thin-lens estimate with object distance u = 300 mm measured from the object-side principal plane, f = u × m ÷ (1 + m) ≈ 20.5 mm. A real lens’s quoted working distance is often measured from the housing rather than that principal plane. Use the manufacturer’s geometry and focus range to select an available focal length and verify the actual field.
With square pixels and a hypothetical 2,448 × 2,048 image, a 120 mm horizontal field gives about 100.4 mm vertically. Confirm that the product and its position variation fit both dimensions. The sampling interval is 120 ÷ 2,448 = 0.0490 mm/pixel. At an illustrative speed of 500 mm/s, limiting blur to one pixel requires exposure ≤ 0.0490 ÷ 500 = 0.000098 seconds, about 98 µs. The light must provide sufficient signal within that exposure.
Test the smallest feature at the centre and corners, at the minimum and maximum product heights, and under production movement. Keep good, defective and borderline samples separate from setup images. Record missed defects, false rejects and image conditions against agreed limits. For measurement, compare with an independent reference and assess bias and repeatability; 0.0490 mm/pixel is sampling, not measurement uncertainty.
Limits
There is no universal megapixel table. Confirm the lens calculation with representative parts under production lighting and motion.
An algorithm can interpolate an edge between pixels, but the result still depends on contrast, lens distortion, calibration and the reference measurement. Validate uncertainty separately from the pixel-count calculation.
If the available distance cannot produce the required field and focus, compare a different lens, a changed camera position or multiple views. Include mounting changes and engineering time when comparing the investment.
Product height and tilt can move the feature outside the sharp region and alter magnification. Test the permitted height range. Stopping down may increase depth of field, while requiring more light and eventually reducing detail through diffraction.

Send the smallest detail size, a field-of-view sketch and the available working distance. We can check the camera and lens combination.