Smallest Defect First: Sizing Camera Resolution for Visual Inspection
Megapixels do not decide what a camera can catch. The smallest defect that changes a part's disposition does. Here is how to work out pixel size, check the lens and motion limits, choose the right output detail, and decide when you need 3D.
See what the camera sees
The smallest defect sets the pixel size.
What the station can tell
Lost in surface texture
The scratch covers too little of each pixel. Its darkness is averaged down until it is no darker than normal surface texture.
- Pixels across the scratch
- 0.25
- Pixels needed across a 100 mm field of view
- 250
Pixel size on the part is the field of view divided by the pixels across it. Shrink the pixel and the same scratch spans more of them.
Choose an example or a setting to explore it.
One question came up more than any other in the working session we described in the first article of this series, and it is the one plant teams ask first: how many megapixels do we need? Their answer was always the same. Wrong question. Tell us the smallest defect that changes what happens to the part, and the camera specification follows from that.
This article turns that conversation into a method you can apply on paper before talking to any supplier. It covers how to calculate the pixel size you need, why the lens and line speed can cap what a sensor delivers, how to match the level of output detail to your disposition rule, and when a flat image is not enough and you need depth. It is the second article in our visual inspection series, after choosing rule-based, supervised, or unsupervised inspection by defect.
Start with the defect that changes the disposition
Every inspection specification should begin with one sentence: the smallest defect that changes what happens to the part. Not the smallest defect anyone has ever seen. The smallest one that moves a part from ship to rework or scrap.
That distinction matters because it is usually much larger than the smallest visible mark. A sealing face might reject a scratch 0.1 mm wide. A cosmetic face on the same part might accept scratches up to several millimeters long. If you size the camera for the cosmetic face, you will miss the seal defect. If you size the whole station for every hairline mark, you pay for resolution you do not need and create false rejects from harmless texture.
Write the rule per zone, with a size and a direction. "Scratch wider than 0.1 mm anywhere on the sealing face" is a specification a camera can be designed against. "No scratches" is not.
Calculate the pixel size you need
The first number to calculate is how much of the part each pixel covers. It is simple arithmetic:
Pixel size on the part = field of view ÷ pixels across that field of view
A camera with 2,000 pixels across, looking at a 100 mm field of view, gives 0.05 mm per pixel. The same camera looking at a 200 mm field gives 0.1 mm per pixel. Zooming out to see the whole part makes every pixel cover more of it.
Now compare the pixel size with your smallest defect. Sampling theory sets a hard floor: a feature must span at least two pixels to be represented reliably. Below that, a narrow feature can fall between pixel boundaries and be averaged into its surroundings. Two pixels is the floor, not the target. How much margin you need above it depends on defect contrast, surface texture, and noise, and it is something to prove in validation rather than assume. The NIST AI Risk Management Framework makes the same point for any automated judgment: accuracy measurements should be paired with realistic test sets that represent the conditions of expected use [5]. For resolution, that means real defects at the edge of the specification, imaged on the line.
Work the example the other way round. If the smallest sealing-face scratch that matters is 0.1 mm wide, two pixels across it means a pixel no larger than 0.05 mm. To cover a 200 mm wide part at 0.05 mm per pixel, you need 200 ÷ 0.05 = 4,000 pixels across. If that is more than a sensible camera provides, you have three honest options: inspect a smaller region (only the sealing face), use more than one camera, or move the part past a line camera that builds the image row by row.
A worked sizing sheet
Smallest disposition-changing defect: 0.1 mm wide scratch on the sealing face. Region that must be inspected: sealing face, 60 mm across. Pixel size for at least two pixels across the defect: 0.05 mm or smaller. Pixels needed across the region: 60 ÷ 0.05 = 1,200, before any validation margin. That is a modest camera. Inspecting the whole 200 mm part at the same pixel size would need 4,000 pixels across.
The interactive replay at the top of this article shows what happens to a 0.1 mm scratch as the pixel size grows. At a small pixel size the scratch spans several pixels and its width can be judged. As pixels grow, it shrinks to one faint pixel, then dissolves into the background shade around it.
The lens and the line can cap what the sensor delivers
Pixel count is only one of three limits. The other two are easy to overlook.
The lens has its own resolution. A lens blurs every point of light into a small spot. If that spot is larger than a pixel, adding more pixels just samples the same blur more finely. The contrast the system delivers is the product of what the lens passes and what the sensor passes, so the weaker of the two sets the result. When a supplier proposes a higher-resolution sensor, ask what the lens resolves at that pixel size and at the working aperture, not just at the center of the image.
Motion smears the image. If the part moves during the exposure, a sharp edge is spread across every pixel it passes. Blur in pixels equals the distance traveled during the exposure divided by the pixel size. With a conveyor at 500 mm per second and a pixel size of 0.05 mm, the part moves one pixel in 0.05 ÷ 500 = 0.0001 seconds, or 100 microseconds. An exposure longer than that smears a 0.1 mm scratch across more pixels than it occupies. Shorter exposures need more light, which is why the lighting article in this series matters as much as this one.
Focus depth shrinks as detail grows. Fine pixel sizes generally come with a shallower range of distances that stay in focus. If parts sit at varying heights on a conveyor, a station that is sharp for one part can be soft for the next. Check focus across the full range of part positions during validation.
Match the output detail to the decision
Resolution answers whether the defect is visible. The next question is how much the station needs to know about it. That depends on the disposition rule, and it decides which kind of model or tool you use. Post 1 in this series covered the methods. This table connects them to the decision.
| Disposition rule | Output the station needs | Typical method | Resolution implication |
|---|---|---|---|
| Any defect of this type rejects the part | Pass or fail per image or region | Image classification | Defect must be visible; size does not need measuring |
| Count or locate defects, such as "no more than two pits" | Location of each defect | Object detection with boxes | Each defect must be separable from its neighbors |
| Size limit per zone, such as "scratch over 1.0 mm long on the sealing face" | Outline of each defect, plus a calibrated millimeters per pixel scale | Segmentation followed by a measuring rule | Several pixels across the defect so length and width can be estimated |
| Dimensional tolerance, such as hole diameter | Measured edge positions | Rule-based gauging | Edge position must be repeatable well inside the tolerance |
| Shape change, such as a dent, warp, or bead height | Height or surface orientation | 3D sensing or multi-angle lighting | Depth resolution matters as much as pixel size |
A survey of deep learning for defect detection describes the difference between detectors that return a location and class probability and segmentation networks that make a prediction for every pixel [1]. For size limits, the outline is what you need. A box drawn around a diagonal or curved scratch overstates its size, so a rule measuring the box will reject parts that the specification would pass.
Small defects remain hard for current AI methods as well. A 2025 benchmark for industrial anomaly detection deliberately included very small defects alongside lighting changes and high variation among good parts, and found that state-of-the-art methods performed far below their results on easier benchmarks [2]. Adequate pixels across the defect are a precondition for any model, not a guarantee.
When a flat image is not enough
A 2D camera records how much light comes back from each point. That works when a defect changes color or reflectance: a stain, a scratch that scatters light, a missing label. It struggles when the defect is a change in shape on a uniform surface. A shallow dent on a matte part can return almost the same light as the surface around it. Warp, coplanarity, and weld bead height are measurements of geometry, not appearance.
Several sensing methods recover shape. A peer-reviewed comparison of 3D vision techniques, written for robot guidance rather than defect inspection, gives a useful sense of scale [3]:
| Technique | How it gets depth | Reported precision in the review | Practical constraint |
|---|---|---|---|
| Passive stereo | Two or more cameras match points between views | About 50 µm | Scene must be static; weak on textureless surfaces |
| Structured light | A projected pattern deforms over the surface | About 0.127 mm with white light; 34 to 60 µm for blue LED variants | Part must stay still while the pattern sequence is captured |
| Laser triangulation | A laser line is imaged at an angle as part or sensor moves | Varies with sensor and range | Needs relative motion, which suits conveyors |
| Time of flight | Measures the travel time of emitted light | About 10 mm | Fast and less affected by ambient light; too coarse for fine defects |
These numbers come from one review in a different application area, so treat them as orders of magnitude, not specifications for your line.
There is also a middle path. Photometric stereo keeps one fixed camera and takes several images with light arriving from different directions [4]. From the way brightness changes with light direction, it recovers the orientation of the surface at every pixel. That reveals shallow relief, such as small dents, embossing, and raised scratches, without a full height measurement. It is a strong fit when the question is "is there a dent?" rather than "how deep is it?". The replay above includes a dent that disappears in a flat image and appears clearly once height is measured.
What this means for maintenance teams
The same arithmetic applies when cameras watch equipment instead of parts. A camera checking belt edge wear, coupling guards, or gauge readings has a field of view and a pixel count, and the smallest change that should trigger a work order sets the requirement. A fixed camera covering a whole conveyor section may see a torn belt but not early edge fraying.
Resolution also degrades in service without anyone changing a setting. A camera knocked slightly out of position changes its field of view. A lens that drifts out of focus or collects film raises the blur spot above a pixel. Monitory treats inspection stations as assets, with their own checks and work orders, so a station that can no longer see its smallest defect gets maintained before quality notices the escapes. To check a planned or existing camera against your own defects, request the free resolution and coverage check at the end of this article. The last article in this series covers that drift in detail.
Summary
Camera resolution is a calculation, not a catalog choice. Start from the smallest defect that changes a part's disposition, calculate the pixel size needed to place at least two pixels across it, then add the margin you prove in validation. Check that the lens can resolve that pixel size, that the exposure is short enough for your line speed, and that focus holds across part positions. Choose output detail from the disposition rule, and use 3D or multi-angle lighting only when the defect is a change in shape.
Next steps for one station:
1. Write the smallest disposition-changing defect for each inspection zone, with size and direction. 2. Calculate the pixel size and pixels across for each zone, and decide whether one camera, several cameras, or a smaller inspection region is the right answer. 3. Calculate the maximum exposure time from line speed and pixel size. 4. Map each disposition rule to classification, detection, segmentation, gauging, or 3D. 5. Validate with real defect samples at the edge of the specification, at line speed, across the full range of part positions.
For the method choice behind step 4, read choosing rule-based, supervised, or unsupervised inspection by defect. For the full path from detection to corrective action, see computer vision quality inspection.
Frequently asked questions
How many pixels should span the smallest defect?
Sampling sets a floor of two pixels across the smallest feature. How much more you need depends on defect contrast, surface texture, noise, and whether you only need to detect the defect or also measure it. Measuring a size limit needs more pixels than simply noticing a mark. Prove the margin with real samples at the edge of the specification instead of relying on a general rule of thumb.
Will a higher-megapixel camera find smaller defects?
Only if the lens can resolve the smaller pixels, the exposure is short enough to avoid motion blur, and the lighting gives the defect enough contrast. A higher pixel count behind a lens that blurs more than one pixel adds data without adding detail.
Why not inspect the whole part at the finest resolution?
The pixel count grows with the size of the field of view. Covering a large part at a fine pixel size can need several cameras or a line-scan setup, and processes far more image data. Inspecting only the critical zones at fine resolution and the rest at a coarser pixel size is often the more practical design.
When do we need 3D instead of 2D?
When the defect is a change in shape that does not change appearance: dents on uniform surfaces, warp, coplanarity, bead height, or missing material that is the same color as its surroundings. If the defect is visible as a change in color or reflectance, 2D with the right lighting is usually enough.
What is the difference between photometric stereo and full 3D measurement?
Photometric stereo recovers surface orientation from images taken with light from several directions, which makes shallow relief visible [4]. It does not by itself give calibrated height in millimeters. Structured light, laser triangulation, and stereo measure height directly, at the cost of more complex setup or motion requirements [3].
References
[1] J. Yang et al., "Using Deep Learning to Detect Defects in Manufacturing: A Comprehensive Survey and Current Challenges", Materials, 2020. https://pmc.ncbi.nlm.nih.gov/articles/PMC7766692/
[2] L. Heckler-Kram et al., "The MVTec AD 2 Dataset: Advanced Scenarios for Unsupervised Anomaly Detection", 2025. https://arxiv.org/abs/2503.21622
[3] L. Pérez et al., "Robot Guidance Using Machine Vision Techniques in Industrial Environments: A Comparative Review", Sensors, 2016. https://pmc.ncbi.nlm.nih.gov/articles/PMC4813910/
[4] R. J. Woodham, "Photometric Method for Determining Surface Orientation from Multiple Images", Optical Engineering, 1980. https://doi.org/10.1117/12.7972479
[5] NIST, "Artificial Intelligence Risk Management Framework (AI RMF 1.0)", 2023. https://nvlpubs.nist.gov/nistpubs/ai/NIST.AI.100-1.pdf
Free for manufacturing and maintenance teams
Free resolution and coverage check
Find out whether a planned or existing camera can actually see the defects that matter.
You send
- The smallest defect per inspection zone
- Part size, line speed, and current camera details if you have one
You get back
- Pixel size and camera coverage options per zone
- The exposure limit for your line speed and a view on whether you need 3D
Not sure where camera inspection fits yet? A discovery call walks through your lines and assets to find the inspection and monitoring problems worth solving first. Prefer someone on site? See the free half-day on-site assessment.
Related articles
Ready to put this into practice?
See how Monitory helps manufacturing teams implement these strategies.