Considerations while working with (industrial) cameras

In this post, I’m going to describe basic and important parameters for camera and lenses. After reading this post you should have the following knowledge:

  • Clearly know what is Focal Length
  • Aperture
  • Depth of View
  • Clear understanding of different types of lenses
  • Field of View
  • Sensor size
  • Shutter Speed
  • ISO
  • Maximum Transmission Unit (MTU)
  • Ground Sample Distance

Understanding these basics is very important whenever you want to work on a project which involves setting up industrial cameras and make it ready for image processing. Let’s get started.

Lenses

Before talking about the different types of lenses used in camera we should understand its components and parameters, basically there are three important parameters for industrial lenses, Focal Length, Aperture and Field of View (FoV) and we will go through each of them and try to make them clear.

Focal Length is basically one of the parameters of the optical system and it is where the light converges or diverges. A positive focal length indicates a system converges the light and a negative diverges the light. Focal Length will be expressed in Millimeter (mm) and basically the manufacturer write it on somewhere on the lens([number/range] mm, for example, 6[-10]mm). People get confused when it comes to the camera and think it is related to projection plane or camera sensor which is false, basically focal lens has nothing to do with camera sensor and it is a parameter related to the lens.

The next thing is Aperture. What it does is basically controlling the amount of light passing through the lens and hit the camera sensor. It will also be written somewhere on the lens with F/f-Number or f/Number or 1:Number (for instance, F1.4, f/1.4 or 1:1.4). This number shows the maximum size of the aperture. Most of the time you will find the focal length and the aperture size written together on the lens and the order could be different by manufacturers, the following example will show the different format of writing focal length and aperture size but they have the same meaning of 6mm in focal length and a maximum aperture of 1.4:

6 mm 1:1.4 = 6 mm f/1.4 = 6/1.4 = 1.4/6 = 6 mm 1:1.4 = 6 mm F1.4

As mentioned before, the bigger the aperture number is the smaller is the apertures hole. Aperture not only have a direct impact on brightness and contrast of the image (more light comes in whiter would be the image and the fewer light the darker), actually, it is one of three parameters (along with shutter speed and ISO) which affects exposure.

A very important point about aperture is that it does affect on Depth of Field because it cause diffraction in light while passing narrow aperture. Whenever we focus somewhere with our camera what actually will happen is that the focal length of the lens is exactly on the camera sensor (tangent), so in this situation all points which are in specific distance from the camera (Z, or focus plane) are in focus and everything in this distance will be sharp in image. But what happens to points which are nearer to the camera or farther from the focus plane? Actually they will become blurry (circle of confusion) in the image. The point here is how blurry they will become, i.e. is the blurriness of point which is much near to the focus plane same as the point which is farther away? The answer is no, basically, blurriness will gradually increase and the Depth of Field defines a distance from focus plane in which the points are acceptably sharp in the image. In this case, by narrowing the aperture we can reduce the circle of confusion (blurriness, the reason is that in this case aperture become a secondary source for propagating the light coming from the point) and as a result, the points become sharper in the image, although they are not in the focus plane. For the physics behind that take a look at DoF, Circule of Confusion and diffraction.

Lens types, I will cover three commonly used in the industry which are fixed focus, prime and zoom lenses. Fixed Focus Lens have fix focal length and will be used for specific working distance, usually we will see this kind of lenses in factories, microscopes, etc. Prime-Lenses also have fixed focal length but they also have a moving lens (focus lens) to change the focus plane/area, so the lights coming from focus place will be converged on camera sensor. In other words, what it does is basically projecting the focus plane on the projection plane or sensor, so we can see that area sharper in the image. For focusing on an object the following formula will be used:

    \[\frac{1}{f} = \frac{1}{s1} + \frac{1}{s2}\]

where f is the focal length, s1 is the distance between the center of the lens and projection plane (sensor of the camera) and s2 is the distance between the center of the lens and the object (that we want to focus on). So if the object is in infinity then the focal length and the distance between the center of the lens and projection plane are the same, otherwise, we should change the focus lens to place the object correctly on the projection plane. An important point about prime-lenses is that they do not change the Field of View. Basically prime-lenses (also called Fixed Focal Length Lens) are lenses with fixed Angular Field of View (AFoV). They have the ability to be focused for different distances while the focal length is constant. Basically the focal length of a lens determines the lens’s angular field of view. And again what focus lens does is basically changing the focus plane.

On the other hand zoom-lenses will change the focal length of the lens system (basically lens system contains different lenses which result an effective focal length). For lens system containing two lenses the effective focal length would be:

    \[\frac{1}{f} = \frac{1}{f1} + \frac{1}{f2} - \frac{d}{f1f2}\]

They also contain the focus lens and the following figure represents an example of a zoom-lens structure.

Color Spectrum
Fig. 1: Structure of Zoom-Lens [1]

The important point about the zoom-lens is that they can adjust the Field of View. Field of View or the area that a camera can capture will be calculated using the following formula:

    \[AFoV[in degree] = 2arctan(\frac{d}{2f})\]

where f is the focal length and d is the sensor size. Usually, we will represent the field of view in horizontal, vertical and diagonal, so for calculating the horizontal angular field of view we should use the horizontal size of the sensor (width) for d and for vertical AFoV, the height and for diagonal AFoV the diagonal value of the sensor will be used. The height and width of the sensor is the multiplication of the number of the pixels and the pixel size.

Parameters about Camera

The first thing that you should know about the camera is its sensor size. The bigger the sensor the larger is the resulting image. People get confused when it comes to the blurriness of the fore-/background of the image. Blurriness has nothing to do with the camera sensor, obviously, if the camera sensor is bigger then the blurriness area/scene of fore-/background is also bigger. As mentioned before blurriness is affected by focus plane and aperture. Sometimes we hear Full frame camera, this term refers to the cameras which have the sensor with the size equivalent to the 35mm film and the size of this sensor is 36mmx24mm. Sensor size can also be expressed by its pixel size.

The other important parameter in-camera is the shutter speed and it is the time the camera needs to capture an image, more simple is the number of images a camera can take in a second. If we set the shutter speed very low and want to take an image of moving object motion blur will happen in the image and it is because the speed of the object is higher than the shutter.

The third important parameter for the camera is ISO. ISO defines the sensitivity of the camera sensor to the light. Generally, by increasing the ISO, camera sensor will be more sensitive to the light and consequently, the resulting image would be noisier and because of that whenever you want to do image processing on an image fist we will smooth the image using box filter/box blur, Gaussian Blur, median Blur or bilateral filter to reduce the noise and then do other processing. For more information about noise reduction in image check Low-Level CV – Convolution, Gaussian. Generally, if it is dark, it is better to use higher ISO for the cost of noisy image and if the light is good low ISO will take a perfect image.

In industrial applications most of the times we want to stream camera over ethernet and do some processing on image frames. There are lots of parameters which affects this streaming among which MTU (Maximum Transmission Unit) plays an important role. Basically MTU defines the largest PDU (Protocol Data Unit) for network and transport layer in OSI network model. To achieve “real-time” streaming, MTU in the camera, as well as the operating system, should be set to high values, if not the result would be an error in packet. If we do not increase the MTU size, then we should increase the delay between packets and the result would be losing frames, i.e. there would lag between frames.

Ground Sample Distance

If you are installing the camera in specific hight or using a drone to take pictures of your site, calculating GSD would be useful because then you can somehow estimate the size of objects. Basically, GSD tells us that the distance between the center of two consecutive pixels corresponds to the measurement of the distance in the ground, roughly said, it estimates how big each pixel is in the ground. The following figure, Fig. 2, represent GSD and its relationship with the camera.

Color Spectrum
Fig. 2: Ground Sample Distance [2]

Calculating the GSD is easy using the size of the camera sensor (width and height or pixel size and exact resolution):

    \[GSD_h = \frac{Hight * Sensor Height}{Focal Length * Image Height}\]

    \[GSD_w = \frac{Hight * Sensor Width}{Focal Length * Image Width}\]

By projecting each pixel to the ground they will be considered as a square and for our estimation, we will consider the bigger value for GSD. For further information check this article.

Summary

It is important to know that focal length is a characteristic of a lens and it determines the AFoV. So in prime-lenses, the focal length is always constant and consequently, the AFoV is also constant (if we don’t change the camera sensor) but we can change the focus plane through focus lens. Also, it is important to remember that setting MTU and packet delay correctly for our application to get image frames in at the right time that there would be enough time for analyzing it.

Share this on:

Add a Comment

Your email address will not be published. Required fields are marked *