Machine Vision Lens Under Changing Working Distance: How to Design Inspection Systems for Product Position Tolerance
A machine vision system is usually designed around a specified working distance, but the product being inspected rarely stays at exactly the same optical position during every production cycle. Conveyor movement, fixture tolerance, product height variation, component thickness, mechanical vibration and normal manufacturing variation can shift the inspection surface closer to or farther from the camera. When this happens, image quality can change even when the camera and lens remain mechanically fixed. The consequences may include changes in field of view, apparent object size, focus, feature size in pixels and measurement repeatability.
For engineers selecting a machine vision lens for changing working distance, this means that the lens should not be chosen only from a nominal working-distance value. The complete acceptable product-position range must be considered. An inspection station designed around 300 mm working distance, for example, may actually need to operate reliably from 285 mm to 315 mm once the mechanical and product tolerances are included. The optical system must therefore remain usable at the closest, nominal and farthest product positions.
This design approach is particularly important in automated defect inspection, component presence inspection, OCR, barcode verification, packaging inspection, electronics inspection and dimensional verification. The Kyptec Automation® Machine Vision Lens portfolio provides multiple focal lengths, sensor-format options and resolution classes that allow system designers to compare optical geometries according to the real inspection requirement rather than choosing a lens simply because its focal length looks suitable on paper.
Why Working Distance Variation Must Be Included in Lens Selection
Working distance describes the distance between the lens and the object being inspected, but in a practical production environment it should often be treated as a range rather than a single value. A part may be nominally positioned at one distance while the actual inspection surface shifts because of product tolerance or machine movement. Even a relatively small Z-axis displacement can influence how much of the product fits inside the image and how many pixels represent the feature being inspected.
When an object moves closer to a conventional machine vision lens, it generally appears larger within the image and the available field of view decreases. When it moves farther away, it appears smaller and the field of view increases. At the same time, movement away from the optimized focus plane can reduce sharpness. These effects are related, but they should not be treated as one problem.
A reliable industrial camera lens for variable object distance must therefore satisfy at least three separate requirements. The complete inspection area must remain inside the image, the smallest important feature must still occupy enough pixels, and the image must remain sufficiently sharp over the permitted product-position range.
If the lens satisfies only one of these conditions, the inspection can still become unreliable.
Start With the Real Product Position Tolerance
Before choosing focal length, define how much the relevant inspection surface can actually move. This should include more than the fixture tolerance alone. The product itself may contain raised, recessed or differently positioned features that increase the effective depth range.
Consider a molded component mounted on a conveyor. The conveyor height may vary by ±3 mm, the component thickness may vary by another ±2 mm, and the inspected feature may sit several millimetres above the product datum. The camera does not inspect the fixture reference plane; it inspects the feature itself. The useful optical tolerance must therefore account for the actual nearest and farthest feature positions.
This is especially important when selecting a machine vision lens for products with different heights. Rather than specifying only “working distance 250 mm,” a more useful requirement would be “inspection surface operates between 240 mm and 262 mm.” This gives the lens designer a real optical range to evaluate.
The same principle should be applied when one station inspects several product variants. If the same lens must remain fixed during product changeovers, the complete height range across all accepted products becomes part of the optical design envelope.
Check Field of View at the Closest Product Position
The nearest permissible product position should be treated as a critical field-of-view condition. As the object moves toward the lens, its projected size normally increases. If the inspection was designed so that the product only just fits within the frame at nominal working distance, an acceptable increase in product height can push edges, locating features or inspection regions outside the image.
For example, if the product is approximately 100 mm wide, designing for a horizontal field of view that is exactly 100 mm provides no useful tolerance. The real requirement should include product-size variation, lateral position tolerance and additional framing margin. Once the product is allowed to move closer to the lens, another level of margin may be required.
This is where machine vision lens field of view calculation becomes an important buying criterion. The correct focal length should allow the required image coverage at the minimum working distance without creating an unnecessarily large field of view at the farthest position.
For applications that require relatively wide coverage from a restricted mounting distance, the Kyptec Automation® KL-1234 8 MM Machine Vision Lens With 25 MegaPixel & 1.1" Format Lens can be evaluated where its sensor format and optical geometry are suitable. A shorter focal length can provide wider scene coverage, but it should never be selected solely to create excessive safety margin because wider coverage also means that the available sensor pixels are spread across a larger object area.
Check Feature Resolution at the Farthest Product Position
The farthest product position creates the opposite design problem. When the object moves away from the camera, the product generally occupies a smaller portion of the sensor. The smallest defect, edge, printed character or component feature may therefore be represented by fewer pixels.
This is particularly important when choosing a machine vision lens for small defect detection. The system should not simply demonstrate that a defect is visible at nominal working distance. The designer should calculate whether it remains sufficiently sampled at the maximum working distance.
Suppose a camera provides 2448 horizontal pixels across a 120 mm field of view. The approximate object-space sampling is 120 divided by 2448, or about 0.049 mm per pixel. A 0.20 mm feature would span roughly four pixels. If the field of view increases when the product moves farther away, the same 0.20 mm feature will occupy fewer pixels.
Whether that remains acceptable depends on the inspection requirement, feature contrast and image-processing method. The important engineering principle is that the smallest feature should be checked at the least favourable product position rather than only under ideal setup conditions.
For higher-resolution applications where a moderate focal length is required, the Kyptec Automation® KL-1238 16 MM Machine Vision Lens With 25 MegaPixel & 1.1" Format Lens provides another geometry to evaluate. A 16 mm focal length can offer a different balance between coverage and image magnification than a very short focal length, provided the camera sensor and working distance are compatible with the required inspection field.
Do Not Confuse Depth of Field With Constant Magnification
Depth of field is frequently discussed whenever product height varies, but depth of field solves only part of the problem. A product may remain acceptably focused throughout a certain Z-axis range while its apparent image size continues to change.
This distinction becomes especially important in dimensional inspection. If the inspection software is calibrated so that a certain number of pixels represents a known physical distance at one object plane, movement toward or away from the camera can change the projected dimensions. The image may still appear sharp while the measurement relationship has changed.
For general presence inspection, defect detection or OCR, moderate scale variation may sometimes be handled by the image-processing software. For precision measurement, edge location or dimensional gauging, the allowed object-height variation may need to be significantly smaller.
A strong machine vision lens selection for dimensional inspection therefore separates two specifications: the amount of Z movement that can remain acceptably focused and the amount of magnification variation that the measurement process can tolerate.
Use Aperture to Improve Depth of Field Carefully
Closing the lens aperture, which means increasing the f-number, generally increases usable depth of field. This is one of the main optical adjustments available when products can appear at different heights.
However, choosing the highest possible f-number is not automatically the best solution. Closing the aperture reduces the amount of light reaching the camera sensor. This may require stronger illumination or longer exposure. If the product is moving, a longer exposure can introduce its own inspection problems. Very small apertures can also reduce fine image detail because of diffraction.
The aperture should therefore be selected as part of the complete imaging system rather than being used as a correction after the lens has already been chosen.
The Kyptec Automation® KL-1240 25 MM Machine Vision Lens With 25 MegaPixel & 1.1" Format Lens provides a 25 mm focal length together with an adjustable aperture range, making it useful to evaluate when an application requires a medium focal length and the system designer needs flexibility to balance brightness, sharpness and usable depth of field.
Sensor Format Is Just as Important as Focal Length
A focal length cannot be selected correctly without considering the camera sensor dimensions. A 25 mm lens does not create one universal field of view because the result changes with sensor format and working distance.
This is why searches such as which machine vision lens focal length should I choose cannot be answered accurately from object size alone. The engineer needs to know the sensor width and height, required horizontal and vertical field of view and available camera-to-object distance.
The Kyptec Automation® Machine Vision Lens portfolio includes options designed around different sensor formats and resolution requirements, allowing system integrators to compare lenses that better match the camera being used. For compatible 2/3" systems, for example, the Kyptec Automation® KL-1226 16 MM Machine Vision Lens With 10 MegaPixel & 2/3" Format Lens can be evaluated for applications requiring a moderate focal length with a 2/3" format camera.
Choosing the correct sensor-format lens also helps prevent unnecessary optical compromises at the image edges, which becomes particularly important when inspection features are distributed across the full sensor rather than concentrated at the centre.
Consider Product Tilt Along With Height Variation
Products do not always move vertically while remaining perfectly parallel to the camera. Fixture wear, part geometry or conveyor movement may introduce tilt. When this happens, one side of the product can move closer to the lens while the opposite side moves farther away.
A system that is tested only by moving a flat target directly toward and away from the camera may therefore underestimate the actual depth range encountered in production.
This is particularly relevant for PCB inspection, packaging inspection, trays, molded parts and larger mechanical components. If important features are distributed across the full product, the optical validation should include centre, edge and corner regions at realistic tilt conditions.
The usable working-distance envelope should therefore account for the nearest and farthest important inspection points, not merely the centre of the product.
Choose Resolution According to the Smallest Required Feature
Buying a higher-megapixel lens can be useful, but lens resolution should always be linked to the actual application requirement. A high-resolution optical system is valuable when the camera sensor and inspection task can make use of that resolution. It does not compensate for a field of view that is so wide that a critical defect receives too few pixels.
A better way to select a high resolution machine vision lens is to begin with the smallest feature that must be inspected. Determine how many sensor pixels should represent that feature under the worst working-distance condition. The field of view can then be checked against camera resolution before choosing the appropriate lens family.
This approach helps explain why Kyptec Automation® provides multiple resolution classes within its Machine Vision Lens category. The buyer can select the optical resolution and sensor format according to the actual imaging requirement instead of treating one megapixel specification as suitable for every inspection.
Longer Focal Lengths Can Help When Camera Mounting Distance Is Greater
Some machines do not allow the camera to be positioned close to the product. Mechanical guarding, tooling, robot movement or machine architecture may require greater stand-off distance. In these situations, a longer focal length may be needed to maintain the required field of view.
The Kyptec Automation® KL-1218 35 MM Machine Vision Lens With 10 MegaPixel & 1" Format Lens provides a 35 mm focal length for compatible 1" format systems. This type of focal length can be evaluated when the camera must operate from a longer working distance while still obtaining suitable object magnification.
For still narrower coverage or increased stand-off requirements, the Kyptec Automation® KL-1220 50 MM Machine Vision Lens With 10 MegaPixel & 1" Format Lens provides another option within the portfolio.
A longer focal length should not, however, be selected simply because higher magnification sounds desirable. At the nearest acceptable product position, the field of view may become too narrow. The entire product-position range must therefore be checked before committing to the lens.
Do Not Design the System With Zero Optical Margin
A production inspection system should have margin in several areas. The complete product should fit inside the image with space for normal position variation. The smallest feature should occupy more than the absolute minimum number of pixels required by the algorithm. Focus should remain acceptable beyond the nominal product plane, and the aperture should not need to operate at an extreme setting simply to make the application function.
This margin becomes particularly important as machines age. Fixtures loosen, conveyors wear and products change slightly over time. An inspection system that works only under ideal initial conditions can become unstable even when none of its components has actually failed.
When comparing different machine vision lens options, it is therefore useful to ask which configuration provides the strongest operating margin rather than which one merely satisfies the nominal calculation.
Validate With Real Production Parts
Optical calculations are essential, but final lens approval should be performed using actual products. Flat calibration targets do not always represent the real geometry of assembled components. A real product may contain raised structures, recessed surfaces, angled features and reflective areas at several depths.
Testing should include samples at the nearest permitted position, nominal position and farthest permitted position. If several product variants will run on the same station, representative examples of each variant should also be tested.
The inspection software should then be evaluated against the same acceptance criteria used for production. Instead of relying only on whether the image appears visually sharp, examine actual feature detection, edge stability, OCR confidence, barcode performance, defect detection or measurement repeatability.
This is the point where a correctly selected machine vision lens demonstrates its real value.
Match the Lens to the Complete Inspection Requirement Before Purchase
A buyer requesting only “a 25 mm machine vision lens” leaves out most of the information required for dependable selection. A much stronger purchase specification includes camera sensor format, camera resolution, object dimensions, required horizontal and vertical field of view, smallest feature, nominal working distance, minimum working distance, maximum working distance and the type of inspection being performed.
Providing these details allows different focal lengths to be compared objectively. A shorter focal length may solve one field-of-view problem but reduce feature sampling. A longer focal length may increase image magnification but create framing problems when the product moves closer. The right lens is the one that maintains the required inspection performance throughout the complete mechanical tolerance range.
Engineers, OEMs and system integrators can review the Kyptec Automation® Machine Vision Lens portfolio to compare available focal lengths and formats according to the application geometry. Where a project requires application-specific selection support, the Kyptec Automation® Contact Us page can be used to share the camera, FOV and working-distance requirements.
Why Kyptec Automation® Is Useful for Variable Working-Distance Applications
Working-distance problems often require engineers to compare several optical configurations before finalizing the machine design. A portfolio that provides different focal lengths, sensor formats and resolution classes gives the integrator more freedom to optimize the inspection geometry instead of forcing the application around one available lens.
Kyptec Automation® provides a focused Machine Vision Lens portfolio for industrial imaging requirements, allowing buyers to evaluate wide, medium and longer focal lengths according to field of view, mounting distance, feature resolution and sensor compatibility. This is particularly useful for OEMs and machine builders designing inspection stations that must tolerate practical product-position variation while maintaining stable image quality.
Rather than selecting a lens from focal length alone, the stronger approach is to match the Kyptec Automation® Machine Vision Lens to the complete operating envelope of the inspection station. This creates a more technically defensible purchase decision and can reduce the amount of optical rework required during commissioning.
Frequently Asked Questions
1. How do I select a machine vision lens when product height changes during inspection?
Start by defining the nearest and farthest positions of the actual feature being inspected rather than using only the nominal product height. Then calculate the required field of view at the closest position and the smallest-feature pixel coverage at the farthest position. After that, evaluate focus and aperture requirements throughout the complete Z range. Kyptec Automation® provides multiple focal lengths within its Machine Vision Lens portfolio, which allows buyers to compare optical geometries according to this complete operating envelope instead of choosing a lens from nominal distance alone.
2. Should working distance be specified as a range when buying a machine vision lens?
Yes. A range is far more useful than a single nominal value whenever product position can change. For example, specifying 240–260 mm gives considerably more application information than simply writing 250 mm. It allows the lens to be evaluated at the two positions most likely to reveal framing, resolution or focus problems. This is particularly important for automated inspection systems where fixture tolerance or product thickness creates unavoidable Z-axis movement.
3. What happens to field of view when the product moves closer to a machine vision lens?
The product normally appears larger, which means less object area fits inside the sensor. If the original image has very little margin, an edge or inspection feature may leave the frame. The correct design practice is to calculate and physically verify the required field of view at the closest acceptable product position rather than only at nominal working distance.
4. Why can small defects become harder to detect when the product moves farther away?
As the object moves farther from a conventional machine vision lens, the same defect generally occupies fewer pixels. Even if focus remains acceptable, the effective object-space resolution can therefore become worse. When purchasing a machine vision lens for defect inspection, the smallest required feature should be evaluated at the farthest permitted inspection plane rather than the easiest one.
5. Can increasing depth of field completely solve product height variation?
No. Increasing depth of field can help maintain acceptable focus over a larger distance range, but it does not remove magnification changes caused by the object moving toward or away from the camera. This difference becomes especially important in dimensional measurement. A product can remain sharp but still change apparent size, so focus tolerance and magnification tolerance should be specified separately.
6. Which focal length is best for machine vision systems with variable working distance?
There is no single best focal length. The correct choice depends on camera sensor size, object dimensions, field of view, available mounting distance, smallest required feature and the full product-position range. Kyptec Automation® offers Machine Vision Lens options across several focal lengths, allowing system designers to compare a wider optical geometry with medium and longer focal-length alternatives instead of assuming one focal length will suit every installation.
7. Is an 8 mm machine vision lens suitable when products move vertically?
It can be suitable when the application needs relatively wide scene coverage and the camera sensor format is compatible. The Kyptec Automation® KL-1234 8 MM Machine Vision Lens With 25 MegaPixel & 1.1" Format Lens is one option that can be evaluated for such applications. However, the wider field should still provide sufficient pixels across the smallest inspection feature at the farthest product position.
8. When should I consider a 25 mm machine vision lens?
A 25 mm focal length may be useful when the application requires a more moderate field of view and greater object magnification than a short focal length can provide. The Kyptec Automation® KL-1240 25 MM Machine Vision Lens With 25 MegaPixel & 1.1" Format Lens can be evaluated where its sensor format and working-distance geometry suit the inspection. The final decision should be based on calculated FOV and feature resolution at both working-distance extremes.
9. How does product tilt affect machine vision lens selection?
Product tilt creates different working distances across the same object. One edge may move closer while another moves farther away even though the centre appears correctly positioned. For large products or features spread across the image, the complete surface should therefore be tested rather than focusing only on the centre. Lens selection should accommodate the real nearest and farthest inspection points generated by both height variation and tilt.
10. Can the same machine vision lens inspect different product variants?
Yes, if every product variant remains within the validated field-of-view, focus and resolution range. The designer should identify the nearest inspection surface, farthest inspection surface, largest required field and smallest feature across all products. The selected lens must satisfy the worst combination rather than merely the nominal or highest-volume SKU.
11. Why does a calibrated dimensional inspection change when the object moves in Z?
A conventional perspective imaging system can change image magnification when the object distance changes. If dimensional calibration was established at one product plane, movement away from that plane can alter the number of pixels representing a physical dimension. For high-accuracy measurement, product-height variation should therefore be mechanically controlled and the remaining tolerance validated across the complete inspection range.
12. Should I choose a higher-resolution machine vision lens when the working distance varies?
Higher optical resolution can be valuable when the camera and inspection task require fine detail, but it should not be used as a substitute for correct imaging geometry. If the required feature occupies too few sensor pixels because the field of view is excessively large, increasing the lens megapixel specification alone will not solve the sampling problem. Kyptec Automation® offers different Machine Vision Lens resolution classes so the optical specification can be matched to the actual sensor and application.
13. When is a 35 mm machine vision lens useful?
A 35 mm focal length can be considered when the camera needs greater stand-off distance or a narrower field than shorter focal lengths provide. The Kyptec Automation® KL-1218 35 MM Machine Vision Lens With 10 MegaPixel & 1" Format Lens can be evaluated for compatible 1" format systems. The nearest product position should still be checked carefully because a narrower field can create framing problems when the object moves closer.
14. What should I test before approving a machine vision lens for production?
Test real products at the minimum, nominal and maximum permitted working distances and at normal production speed. Check all critical inspection regions rather than only the centre of the image. Confirm that the complete target remains within the frame, the smallest features remain sufficiently represented, image sharpness is acceptable and the actual inspection algorithm performs consistently. This provides a much stronger validation than examining one stationary reference sample.
15. What information should I provide to Kyptec Automation® when asking for machine vision lens selection support?
Provide the camera sensor size or camera model, camera resolution, required field of view, object dimensions, smallest feature, nominal working distance, nearest working distance, farthest working distance and the inspection application. If the product can tilt or several product variants will use the same station, those details should also be included. This information allows the Machine Vision Lens requirement to be evaluated around the complete production geometry rather than only one specification.
16. Can a 50 mm machine vision lens work in an inspection system where product position changes?
Yes, when the required field of view, sensor format and available working distance support that focal length. The Kyptec Automation® KL-1220 50 MM Machine Vision Lens With 10 MegaPixel & 1" Format Lens can be considered for compatible systems requiring longer focal length. Because a 50 mm lens generally produces a narrower field than shorter alternatives in comparable conditions, field coverage at the closest product position should be verified carefully before purchase.
Conclusion
Designing a reliable machine vision inspection system under changing working distance requires more than finding a lens that produces a sharp image at one nominal position. The engineer must understand how product movement changes field of view, apparent feature size, focus and measurement scale across the complete operating range.
The strongest design process begins by defining the actual minimum and maximum inspection planes, including product tolerance, fixture movement, feature height and possible tilt. The closest position should be checked for field-of-view margin, while the farthest position should be checked for the smallest required feature resolution. Depth of field should then be optimized without assuming that it eliminates changes in image magnification.
Sensor format, camera resolution, focal length, aperture, object size and working distance should all be treated as parts of one optical system. A shorter lens may provide greater framing margin but fewer pixels on the target. A longer focal length may provide greater magnification but create a narrower field at close product positions. The best machine vision lens is therefore the one that maintains adequate inspection performance throughout the real tolerance envelope rather than the one that performs best only at nominal distance.
For OEMs, system integrators and machine builders comparing machine vision lenses for variable working distance, machine vision lenses for automated inspection, industrial camera lenses for product height variation, high-resolution machine vision lenses for defect detection or C-mount machine vision lenses for industrial inspection, Kyptec Automation® provides a focused portfolio spanning multiple focal lengths, sensor formats and resolution classes. The complete Kyptec Automation® Machine Vision Lens category can be used to compare suitable optical configurations according to the actual inspection geometry, while application-specific requirements can be shared through the Kyptec Automation® Contact Us page.
A machine vision system becomes significantly more robust when working distance is treated as a tolerance rather than a fixed number. Designing around the real production envelope from the beginning helps preserve framing, usable detail and inspection consistency as product position changes, reducing avoidable optical adjustments after the machine reaches the production floor.

Share:
Line Scan Camera Lens Lot-to-Lot Repeatability for OEM Production: How to Control Optical Variation Across Multiple Machines
Line Scan Camera Lens Lot-to-Lot Repeatability for OEM Production: How to Control Optical Variation Across Multiple Machines