What Machine Vision Lens Is Required to Detect Small Defects? Resolution and Pixel Calculation Guide

Detecting a small defect with a machine vision camera is not mainly a question of buying the highest resolution lens available. The more useful starting point is to calculate how many camera pixels will represent the defect after the complete required inspection area is fitted into the image.

A scratch measuring 0.2 mm can be easy to detect in one vision system and almost invisible in another, even when both cameras have the same megapixel count. The difference often comes from field of view, pixel density on the object, defect contrast, optical resolution, focus and illumination.

This is why buyers looking for a machine vision lens for small defect detection should begin with the defect itself.

How wide is the smallest defect that must be found?

How large is the complete area that must be inspected?

How many camera pixels are available across that area?

How many pixels will therefore fall across the defect?

Can the selected machine vision lens preserve enough optical detail for those pixels to remain useful?

Once these questions are answered, choosing between a moderate resolution industrial camera lens and a higher resolution machine vision lens becomes much more systematic.

Kyptec Automation® provides machine vision lenses across different focal lengths, optical resolution classes and sensor formats. This is useful for defect inspection because the lens can be selected after the required pixel density and inspection geometry have been established rather than simply choosing the highest megapixel specification.

Small Defect Detection Starts with Object Space Resolution

The most important calculation for small defect inspection is object space resolution.

Object space resolution tells you how much of the real object is represented by one camera pixel.

A simple way to calculate it horizontally is:

Object space resolution = Horizontal field of view ÷ Horizontal camera pixels

If a camera captures 3000 horizontal pixels across a 300 mm field of view, each pixel represents approximately 0.1 mm of the object.

If the field of view is reduced to 150 mm while the camera resolution remains unchanged, each pixel now represents approximately 0.05 mm.

The camera did not gain any pixels. The same number of pixels is now concentrated across a smaller physical area.

This relationship is fundamental when designing an industrial vision system for tiny defect detection.

Why One Pixel Across a Defect Is Usually Not Enough

Suppose the calculated object resolution is 0.1 mm per pixel and the smallest defect is also approximately 0.1 mm wide.

Theoretically, the defect corresponds to about one pixel.

That does not mean it can be detected reliably.

The defect may not align perfectly with a pixel boundary. Its contrast may be weak. The lens may slightly blur its edges. The object may move. Illumination may vary. Image processing may interpolate or filter the signal.

A feature represented by only one pixel therefore provides very little inspection margin.

For reliable automated defect detection, designers usually want the smallest critical feature to span multiple pixels.

There is no universal number that applies to every application because detection requirements differ. A high contrast dark hole against a white surface may require fewer pixels than a faint hairline scratch on reflective metal.

The correct pixel requirement should therefore include safety margin rather than being designed exactly at the theoretical visibility limit.

Pixels Across a Defect Is a Better Buying Metric Than Camera Megapixels

Instead of asking whether a 5 MP, 10 MP or 25 MP camera is sufficient, ask how many pixels the defect occupies in the final image.

This gives the camera resolution a practical meaning.

Consider a 0.5 mm defect.

If the system produces 0.1 mm per pixel, the defect spans about five pixels.

If the system produces 0.05 mm per pixel, it spans about ten pixels.

If the system produces 0.25 mm per pixel, the same defect spans only about two pixels.

The physical defect has not changed. Only the imaging geometry has changed.

The lens should then be selected so it can preserve enough contrast and spatial detail for that pixel sampling to remain useful.

Worked Example: Detecting a 0.5 mm Defect

Suppose an industrial camera provides 4096 horizontal pixels and the application needs to inspect a 400 mm wide product.

Object space resolution is:

400 mm ÷ 4096 pixels = approximately 0.098 mm per pixel.

A 0.5 mm defect would therefore occupy approximately:

0.5 ÷ 0.098 = about 5.1 pixels.

That can provide a reasonable starting sampling level for many high contrast features, although the actual inspection must still be validated using real defects, lighting and image processing.

Now suppose the smallest required defect becomes 0.2 mm.

At the same object resolution:

0.2 ÷ 0.098 = about 2 pixels.

The system has suddenly become much more demanding.

The buyer now has several possible design choices. The field of view can be reduced. A camera with more horizontal pixels can be selected. Multiple cameras can divide the inspection area. Or the inspection can be redesigned so the defect receives more useful pixel coverage.

Simply changing from a 10 MP lens to a 25 MP lens without changing the camera sampling will not automatically solve the pixel shortage.

Worked Example: Detecting a 0.1 mm Defect Across a 100 mm Field of View

Suppose an application must inspect a 100 mm wide component and reliably identify a defect measuring approximately 0.1 mm.

If a designer wants the feature to span approximately five pixels, the required object sampling would be:

0.1 mm ÷ 5 = 0.02 mm per pixel.

Across a 100 mm field, the approximate horizontal pixel requirement becomes:

100 mm ÷ 0.02 mm = 5000 horizontal pixels.

That tells the engineer something extremely useful before selecting the lens.

A camera with only 2000 horizontal pixels would not provide the desired five pixel sampling across the defect at the full 100 mm field of view.

Even the best industrial camera lens cannot create pixels that do not exist on the sensor.

The camera resolution, field of view and defect size must therefore be solved together.

Once a camera with sufficient sampling is chosen, a lens with adequate optical resolution can be selected so those small pixels receive a sharp image.

Worked Example: Detecting a 0.05 mm Surface Mark

Now consider a very small 0.05 mm surface mark.

If the inspection requires approximately five pixels across the feature, target sampling becomes around 0.01 mm per pixel.

If the required field of view is 50 mm wide, approximately 5000 horizontal pixels would be needed.

If the field must be 200 mm wide, the requirement increases to roughly 20,000 horizontal pixels for the same five pixel sampling.

That is a very different imaging system.

The calculation reveals why extremely small defect detection across a very large product can become expensive or technically challenging.

Instead of buying one camera with ever higher resolution, a designer may decide to use multiple views, scan the product, reduce the inspected area, or inspect only critical regions.

Pixel calculation therefore influences the complete architecture of a machine vision system, not just the lens choice.

How Much Pixel Margin Should You Design For?

It is tempting to calculate the absolute minimum number of pixels needed to see a feature and design the system exactly at that limit.

Production environments make that risky.

Real defects vary in orientation, shape, brightness and contrast. Product position can move slightly. Lighting output changes over time. Focus can drift. Vibration can introduce minor blur.

A feature that occupies four pixels under ideal laboratory conditions may not provide the same signal after these variations are introduced.

For this reason, a practical machine vision system normally includes sampling margin.

The exact margin should be validated from actual good and defective parts.

The goal is not merely to see the defect once. The system must find it repeatedly across realistic production variation.

Lens Resolution Must Support the Pixel Calculation

Once the required pixels per defect have been established, the next question is whether the lens can deliver enough optical detail to the sensor.

A high resolution industrial camera can only record information that reaches it through the lens.

If the lens blurs nearby details together, extra camera pixels may sample that blur rather than capture additional useful information.

This is where lens resolution becomes important.

A moderate camera and relatively large defect may work well with a 5 MP class machine vision lens.

A denser camera sensor and smaller inspection feature may justify 10 MP optics.

A high resolution sensor designed to capture very small details across a large field can require 25 MP class machine vision optics.

Kyptec Automation® provides these different optical resolution ranges in its Machine Vision Lens collection, making it possible to choose the lens after calculating the imaging requirement.

When a 5 MP Machine Vision Lens Can Still Detect Small Defects

Small is relative to the field of view.

A 0.25 mm defect may sound extremely small, but if the camera observes only a 20 mm region, the defect can occupy a substantial number of pixels.

This means small defect detection does not automatically require a 25 MP lens.

If the field of view is compact and a suitable camera provides enough pixels across the feature, a 5 MP optical system may be sufficient.

For example, Kyptec Automation® KL-1208 25 mm 5 MP Machine Vision Lens provides a 25 mm C mount option for compatible 2/3 inch cameras.

The correct question is whether that complete camera and lens combination provides enough object space resolution for the defect.

When a 10 MP Lens Becomes More Useful

A 10 MP machine vision lens becomes attractive when a higher density camera is being used and the inspection needs to preserve smaller edges, cracks, marks or dimensional differences.

Kyptec Automation® KL-1222 is an 8 mm 10 MP Machine Vision Lens for compatible 2/3 inch systems. At the opposite end of the focal length range, Kyptec Automation® KL-1232 is a 50 mm 10 MP Machine Vision Lens.

Both are 10 MP optical class lenses, but their focal lengths suit very different fields of view and working distances.

This shows why defect detection requires two different decisions.

First decide how many pixels are required across the defect.

Then select the focal length needed to place the required inspection area onto the sensor.

Resolution and focal length solve different problems.

When 25 MP Machine Vision Optics Become Justified

A 25 MP lens becomes particularly useful when the inspection system combines a high resolution sensor with very small object details.

For example, one camera may need to inspect a broad electronics assembly while still distinguishing tiny surface, print or placement defects.

Reducing the field of view could improve sampling but would lose coverage.

Using a higher resolution sensor can preserve the large inspection area while increasing the number of pixels available across small features.

For that strategy to work, the lens must preserve the additional optical detail.

Kyptec Automation® KL-1238 is a 16 mm 25 MP Machine Vision Lens, while Kyptec Automation® KL-1240 provides a 25 mm 25 MP Machine Vision Lens.

For tighter framing or longer working distances, Kyptec Automation® KL-1244 provides a 50 mm 25 MP Machine Vision Lens.

The value of these lenses appears when the camera sensor and inspection task genuinely use the higher optical resolution.

Defect Width Is Not Always the Only Dimension That Matters

Defects are rarely perfect squares.

A scratch may be 10 mm long but only 0.05 mm wide.

A crack can have irregular branches.

A dent may be large in diameter but produce only a subtle intensity change.

A pinhole may be nearly circular.

When calculating sampling requirements, the smallest critical dimension is often the important one.

For a narrow scratch, the width can determine detectability even when its length occupies hundreds of pixels.

This is why describing a defect simply as “5 mm long” can be misleading.

The vision supplier should know the width, length, contrast, orientation and appearance of the smallest acceptable and unacceptable defect whenever possible.

Why Contrast Can Matter as Much as Pixel Count

A defect occupying many pixels can still be difficult to detect if it looks nearly identical to the surrounding surface.

Pixel calculation tells you whether the camera has enough spatial sampling.

It does not guarantee that the defect produces enough image contrast.

Consider a dark 0.2 mm hole on a bright surface. It may create a strong intensity difference.

Now consider a shallow 0.2 mm dent on a reflective metal surface. Under flat illumination, the dent may produce very little brightness difference.

Both defects have the same physical size, but the second can be much harder to detect.

Lighting geometry therefore needs to convert the physical defect into visible contrast.

The machine vision lens then needs to preserve that contrast at the spatial scale being inspected.

Why Defect Orientation Changes Detectability

A very thin feature aligned differently relative to the camera pixel grid can produce different image responses.

This matters particularly when a feature is close to the sampling limit.

A defect that spans several pixels provides more tolerance to orientation and subpixel position than a defect that barely covers one or two pixels.

This is another reason to avoid designing exactly at the theoretical minimum.

Pixel margin improves robustness when defects can appear at arbitrary angles.

Why Focus Error Can Destroy Small Defect Information

When inspecting large objects or large features, a small focus error may be tolerable.

For tiny defect detection, the same error can significantly reduce contrast around the feature.

A narrow scratch can blur into the surrounding texture.

A sharp edge can become a gradual transition.

A small hole can appear smaller or less distinct.

The lens should therefore provide stable focus at the actual working distance, and the camera mounting should resist vibration or movement.

For three dimensional parts, sufficient depth of field must also be maintained so defects remain sharp across the expected height variation.

Aperture Selection Can Affect Fine Defect Visibility

Closing the lens aperture can increase depth of field, which may help when product height varies.

But closing the aperture too far can reduce fine image detail because of diffraction.

Opening it very wide provides more light but may reduce depth of field and can make focusing more sensitive.

For small defect detection, aperture is therefore an optimization parameter rather than simply a brightness control.

The best setting balances light level, depth of field, exposure time and optical sharpness.

Real part testing is especially useful when the target defect approaches the system resolution limit.

Why Motion Blur Must Be Included in the Pixel Budget

Suppose a defect is designed to occupy five pixels.

If product movement during exposure smears the image by three pixels, much of the intended sampling advantage can disappear.

For high speed conveyor inspection, motion blur should therefore be considered alongside spatial resolution.

Short exposure time and sufficient illumination may be necessary to freeze motion.

The lens cannot restore detail that has been averaged across pixels during movement.

When very small defects are inspected at high production speed, lighting power and exposure control can become just as important as camera and lens resolution.

Why Image Compression and Resizing Can Hide Small Defects

The camera may capture enough detail, yet the defect can disappear later in the image processing pipeline.

This can happen if images are aggressively resized, compressed or transferred at reduced resolution before inspection.

A five pixel defect in the original image could become a two pixel feature after downsizing.

Image processing architecture should therefore preserve the sampling required by the defect.

When selecting a high resolution camera and lens specifically for small defect detection, make sure the subsequent software workflow does not discard the very information the optical system was designed to capture.

Region of Interest Can Be More Efficient Than Increasing Everything

Sometimes only a small region of the product contains critical defects.

In such cases, reducing the region of interest can allow more processing attention to be focused on that area.

However, software cropping does not create additional optical resolution if the camera still images the same field of view.

The strongest improvement comes when the optical field itself is reduced so more sensor pixels represent the critical region.

This may require a different focal length, closer working distance, another camera or a dedicated inspection view.

For multi stage inspection systems, one camera can perform general product verification while a second high magnification camera handles the smallest defects.

How to Calculate Maximum Field of View from Defect Size

Pixel calculations can be reversed to determine how much area a camera can inspect while maintaining a chosen sampling level.

Suppose the smallest defect is 0.2 mm and the design target is five pixels across that feature.

Required object sampling is:

0.2 mm ÷ 5 = 0.04 mm per pixel.

If the camera has 4096 horizontal pixels, the maximum horizontal field of view for that sampling level is approximately:

4096 × 0.04 mm = 163.84 mm.

This gives the system designer a practical limit.

If the customer requires a 400 mm field of view with the same camera and still expects the same five pixel coverage of a 0.2 mm defect, the requirements are mathematically incompatible.

The options are to use more camera pixels, reduce the field, use more than one camera or reduce the target pixel requirement if testing shows the defect can be detected reliably with fewer pixels.

This is one of the most useful calculations to perform before purchasing a machine vision lens.

How to Calculate the Camera Resolution Needed for a Known Defect

The same equation can be rearranged.

Suppose a 250 mm field of view is mandatory and the smallest defect is 0.25 mm.

If the design requires five pixels across the defect, each pixel should represent about 0.05 mm.

Required horizontal camera pixels are therefore approximately:

250 mm ÷ 0.05 mm = 5000 pixels.

That means the camera should provide around 5000 or more useful horizontal pixels before optical and processing margins are considered.

Once a suitable camera is chosen, the industrial camera lens should match its sensor size, focal length requirement and optical resolution.

This is a much stronger buying method than choosing a lens first and hoping the resulting image can see the defect.

Why Sensor Megapixels Alone Can Be Misleading

Megapixels describe total image pixel count, but defect calculations often depend strongly on horizontal or vertical pixel count.

A camera with a given total megapixel rating can have different image dimensions depending on aspect ratio.

For a long horizontal inspection, horizontal resolution may be the limiting specification.

For a tall narrow component, vertical resolution could matter more.

Always use the pixel dimension corresponding to the physical direction in which the smallest defect must be resolved.

This produces a more accurate object resolution calculation than relying only on total megapixels.

Frequently Asked Questions About Machine Vision Lens Selection for Small Defect Detection

1. Can a machine vision camera reliably detect a defect that is only one pixel wide?

A one pixel signal can sometimes produce a detectable intensity change, especially if contrast is extremely high, but it provides very little reliability margin. Subpixel alignment, blur, noise and lighting variation can change the result significantly. Industrial inspection is normally more robust when the smallest critical defect spans multiple pixels. Lens selection should therefore support a camera and field of view combination that provides adequate sampling margin.

2. Why can I see a tiny defect with my eyes but the vision camera misses it?

Human vision interprets shape, context, movement and changing reflections very effectively. A fixed camera sees only the optical information provided by its sensor, lens and lighting at the moment of exposure. The defect may occupy too few pixels or produce insufficient contrast. Improving the system can require a narrower field of view, more camera pixels, better illumination or a higher resolution lens rather than simply increasing software sensitivity.

3. Should pixel calculation use the defect width or its total area?

Use the smallest dimension that must be resolved. For a long thin scratch, width may be far more important than total area or length. If the scratch is 10 mm long but only 0.05 mm wide, the 0.05 mm dimension is likely to control the optical resolution requirement.

4. How does the required inspection confidence affect lens resolution?

A system that only needs occasional indication of a defect can operate closer to its sampling limit than a production system expected to reject virtually every defective component reliably. Higher inspection confidence usually requires more margin in pixel sampling, contrast, focus and illumination. A compatible Kyptec Automation® lens should therefore be selected after the required detection reliability is considered, not simply after calculating the theoretical minimum.

5. Can increasing digital zoom help detect a defect that occupies too few pixels?

No. Digital zoom enlarges existing pixels but does not create new optical detail. If a defect occupies two sensor pixels, enlarging the image on screen does not turn it into a genuinely ten pixel measurement. To gain real spatial information, the optical field of view must be reduced or the camera must provide more sensor pixels across the object.

6. Why does a small crack disappear when I increase the camera field of view?

Increasing field of view spreads the available camera pixels across a larger physical area. Each millimetre of the object therefore receives fewer pixels. A crack that previously occupied six pixels might fall to two or three pixels after the field is widened. If wide coverage and fine defects are both mandatory, a higher resolution sensor or multiple camera strategy may be required.

7. Is defect length or defect width more important when selecting an industrial camera lens?

The limiting dimension is usually more important. For thin scratches, fibres, cracks and edge chips, width can determine whether the feature is resolved. For small circular holes or spots, diameter may be the relevant value. Lens and camera selection should be based on the smallest dimension that the inspection algorithm must distinguish.

8. Can better lighting reduce the camera resolution needed for defect detection?

Better lighting can greatly improve contrast and may allow a feature to be detected more reliably at a given sampling level, but it cannot replace missing spatial resolution indefinitely. A feature still needs enough camera sampling to produce a meaningful image pattern. The strongest system combines sufficient pixels with lighting that makes the defect visually distinct.

9. Why are defects visible when the machine is stopped but missed while production is running?

Motion blur, vibration or shorter effective illumination can reduce defect contrast while the line is moving. The optical resolution may be adequate in a static test but insufficient once movement smears the feature across neighbouring pixels. High speed defect inspection should therefore be tested at real production speed before the camera and lens configuration is finalized.

10. Does inspecting a reflective metal surface require more lens resolution?

Not automatically. Reflective surfaces often create a contrast problem rather than purely a resolution problem. Small scratches or dents may appear or disappear depending on illumination angle. First create lighting that reveals the defect clearly, then calculate the spatial resolution required to sample it. A higher resolution Kyptec Automation® machine vision lens becomes valuable when the camera itself needs to preserve those fine details.

11. How can I tell whether poor defect detection is caused by the lens or the camera?

Start by calculating how many pixels theoretically cover the defect. If the camera provides only one or two pixels across it, sensor sampling is likely a major limitation. If the camera provides ample pixels but the feature remains optically soft despite correct lighting and focus, the lens may be limiting contrast or spatial detail. Controlled resolution targets and comparison testing can help separate sensor and lens limitations.

12. Can a longer focal length help detect smaller defects without changing the camera?

Yes, if the longer focal length reduces the field of view so that the target occupies more camera pixels, while still keeping the complete required inspection area visible. The tradeoff is narrower coverage. Kyptec Automation® offers different focal lengths within its machine vision lens range, including Kyptec Automation® KL-1232 at 50 mm for compatible 2/3 inch 10 MP systems and Kyptec Automation® KL-1244 at 50 mm for compatible high resolution larger format systems.

13. How should I calculate pixels for a defect that can appear in any direction?

Use the smallest defect width and provide sufficient sampling in both horizontal and vertical image directions. Orientation can change how a narrow feature falls across the sensor pixel grid, so additional margin is useful when cracks or scratches can appear at arbitrary angles.

14. Should I test artificial defect samples before buying the final machine vision lens?

Yes, when possible. Representative good and defective samples provide much stronger evidence than theoretical calculations alone. Include defects close to the acceptance threshold and test them under real working distance, lighting, motion and focus conditions. The calculation identifies the likely optical requirement; sample testing verifies whether the chosen camera and Kyptec Automation® lens provide enough real inspection margin.

15. What details should I provide when asking for a lens for micron or sub millimetre defect inspection?

Provide the smallest defect width and length, complete required field of view, camera sensor and resolution, working distance, object surface, expected defect contrast, production speed and whether defects can appear at different heights or angles. These details allow the Kyptec Automation® Machine Vision Lens range to be narrowed according to the actual optical resolution and field of view requirement instead of recommending a lens from the defect size alone.

A Practical Buying Method for Small Defect Inspection

The most reliable buying process begins with the smallest unacceptable defect.

Measure its smallest important dimension.

Choose a realistic number of pixels that should represent that feature based on required detection reliability and sample testing.

Divide the defect size by the target number of pixels to obtain the required object space resolution.

Use the required field of view to calculate how many horizontal and vertical camera pixels are needed.

Select an industrial camera that provides sufficient sensor sampling.

Then calculate the focal length required to map the field of view onto that sensor from the available working distance.

Finally, select a machine vision lens with the correct sensor coverage and enough optical resolution to preserve the information the camera needs.

For an inspection where moderate optical resolution is sufficient, a lens such as Kyptec Automation® KL-1208 can be considered when its 25 mm focal length, 5 MP class and 2/3 inch format suit the selected camera and geometry.

For a denser 10 MP imaging requirement, Kyptec Automation® KL-1222 at 8 mm, Kyptec Automation® KL-1216 at 25 mm, Kyptec Automation® KL-1218 at 35 mm or Kyptec Automation® KL-1232 at 50 mm can address different fields of view and compatible sensor formats.

When very high camera resolution is justified, Kyptec Automation® KL-1238 at 16 mm, Kyptec Automation® KL-1240 at 25 mm and Kyptec Automation® KL-1244 at 50 mm provide 25 MP optical options for compatible larger format cameras.

The benefit of this range is not simply access to a higher megapixel specification. It gives engineers the ability to choose optical resolution and focal length separately according to the defect calculation.

Final Answer: What Machine Vision Lens Do You Need to Detect a Small Defect?

The required machine vision lens cannot be determined from defect size alone.

A 0.1 mm defect does not automatically require a particular focal length or megapixel lens.

First calculate how many pixels must represent that defect.

Then determine the object space resolution required to achieve that sampling.

Use the complete inspection field of view to calculate the necessary camera pixel count.

Once the camera and sensor are known, determine the focal length required for the available working distance.

Finally, choose an industrial camera lens that covers the sensor and preserves enough optical detail for those pixels.

This sequence avoids two common purchasing mistakes.

The first is buying a very high resolution lens while using a camera or field of view that still provides too few pixels across the defect.

The second is purchasing a high resolution camera while pairing it with optics that cannot preserve the extra detail.

Reliable small defect detection comes from matching defect size, pixels per feature, field of view, sensor resolution, lens resolution, focal length, illumination, focus and motion control as one imaging system.

Kyptec Automation® is useful for this type of system design because its machine vision lens portfolio includes multiple resolution classes and focal lengths for industrial inspection requirements rather than treating one lens specification as suitable for every defect size.

For buyers, OEMs and machine vision system integrators, the most important number is therefore not the megapixel rating printed on the lens.

It is the number of useful pixels that the smallest critical defect occupies in the final production image.

Calculate that number first, and machine vision lens selection becomes considerably more precise.