<img alt="" src="https://secure.leadforensics.com/11743.png" style="display:none;">

Machine Vision Optics: Choosing the Right Lens for Your Application

In Part 1 and Part 2 of this series of blogs on machine vision optics, we covered a range of parameters that contribute to overall image quality. We also took a fundamental look at MTF charts and how they work, and covered aberrations and distortion in machine vision lenses.

In this week’s blog we will be putting everything we have considered so far into the decision-making process, equipping you with the tools and the knowledge to decide confidently which lens you will need for your machine vision application.

The following guide will work on the basis that you have decided on, or have already purchased, your camera and illumination components.

Computar offer a wide range of high-quality machine vision lenses, available in a range of focal lengths and resolutions.

What Makes a Lens Perfect?

There are several variables that differentiate lenses, and you will need to make decisions on all of these for your vision system. The two most fundamental of these variables are focal length and maximum aperture.

The focal length will determine the magnification of the image projected onto the image plane, and aperture will determine the amount of light that passes through to the sensor.

Focal length will also determine the angle of view, with short focal lengths allowing wider fields of view, and longer focal lengths allowing a narrower field of view.

Ultimately, the relationship between a lens’s focal length and the sensor size will determine the viewing angle for your vision system. For a determined lens, the bigger the sensor size of the camera, the wider the field of view.

For a determined sensor size, there will be normal, wide-angle, and long-focus (such as telephoto) lenses. Once you know your sensor size and required viewing angle, you can then use that information to calculate the focal length of your ideal lens.

The aperture of your lens – wider apertures having a smaller f-number than narrower ones – will have a relationship with the shutter speed of your camera as well. The faster the shutter speed, the less time for exposure, so the lower the f-number (wider aperture) you will need to capture a good image.

What is my Machine Vision Application?

There are several questions you will need to answer before knowing which lens to select. Whatever your sector is, whether it be automotive, industrial, packaging, or food and beverage production, you will need to apply the following questions to your planned application:

What is your Field of View (FoV) in millimetres (mm)?

What is your Working Distance (WD) in millimetres (mm)?

What is the sensor size of your camera in millimetres (mm)?

What wavelengths are you expecting in nanometres (nm)?

What pixel size does your sensor employ in micrometres (μm)?

These are the initial points you need to know in order to calculate the type of lens you will need. The success or failure of your project may well hinge on the accuracy of these key elements, so make sure you prepare rigorously – you will be rewarded when your lens is providing you with crisp, high-resolution images.

Sensor Size

Sensor format and resolution are core building blocks for calculating your ideal lens. Often measured diagonally in inches, these sensor formats will require different lenses to illuminate them optimally.

Common sensor formats for machine vision cameras

Common sensor formats for machine vision cameras

Which Focal Length Do I Need?

In order to calculate the focal length of your ideal lens, you will need to know the working distance, field of view, and sensor size. You can then plug these figures into the below formula:

Focal Length Formula

My Ideal Focal Length Does not Exist!

Rather crucially, this calculation may give you a number that does not match up with an existing focal length option.

For example, let’s say you have a working distance of 300mm, your object size is 100mm wide by 75mm tall, and your sensor size is 2/3”.

WD 300mm, Object width 100mm, Object height 75mm, sensor size 2/3”.

WD 300mm, Object width 100mm, Object height 75mm, sensor size 2/3”.

Plugging these numbers into our formula gives us an ideal focal length of 26.4mm.

After researching this you will most likely not find a lens that exists with a 26.4mm focal length. They are usually available in common standards, with some variation depending on the manufacturer. VST offer lenses in focal lengths of 3.5mm, 4.5mm, 6mm, 8mm, 12mm, 16mm, 25mm, 35mm, 50mm, 75mm, and 100mm. Most manufacturers will roughly adhere to these increments, and with 25mm being the closest option to our above example, this is most likely the best focal length option in this scenario.

Pixel Size for Machine Vision Lenses

Most lenses give an optimal pixel size and wavelength bandwidth to work in. Usually, lenses operate within the visible light spectrum unless specified as Near-Infrared (NIR) or Short-Wave Infrared (SWIR).

It is of paramount importance that the resolution of your lens makes sense for the level of detail required for your application. It is also just as important to use a sensor with an appropriate resolution and pixel size to resolve the detail required in your application.

We strongly recommend taking a look at MTF charts for the lens(es) you are considering, as this is the best way of figuring out if they will provide you with the level of contrast and detail you require. If you are not sure about MTF charts, be sure to check out our blog post that explains how they work.

VST Lenses charted by sensor size and pixel size.

VST Lenses charted by sensor size and pixel size.

Our range of lenses will suit a wide spectrum of applications, and we also offer a broad variety of high-quality optical filters so you can customise your choice of optical components to match your particular vision system specifications.

Lens Mount Types Explained

The three most common types of lens thread mounts are C-mount, S-mount, and CS-mount.

C-Mount Lenses

The most common lens mount type in machine vision. With an inside diameter of 25.4mm, screw pitch of 0.794 mm, and flange focal length of 17.526 mm, they benefit from the widest selection of accessories and compatibility.


The M118 C-mount lens from Tamron


A slightly less common lens mount type, but still used often enough in machine vision. The key difference here is the shorter flange focal length, so you may need an adapter if using a camera suitable for C-mount lenses. Measurements are as follows: Inside diameter 25.4 mm, screw pitch 0.794mm, and flange focal length 12.5mm.


This is a rarer lens mount type, suitable for very small lens configurations and often used in conjunction with compact cameras for small-footprint vision systems, such as with board-level cameras. These are completely incompatible with C- and CS-mounts. 

Helping You Make the Right Vision Decision

That wraps up this series of blogs on machine vision optics. Next week we’ll be embarking on a brand-new series of blogs on Deep Learning for machine vision, so don’t forget to subscribe if you haven’t already!

Whether you’re an OEM, a system integrator, engineer or even an end user, be sure to check our great range of machine vision products for the best machine vision components on the market.




Machine Vision lets computers read barcodes, data matrix codes, direct part marks, optical character recognition and optical character verification – Learn more about the computer vision technology here

Learn More