# Video Monitoring

# Monitoring of Premises

License plate recognition (LPR) systems - part 1: Camera positioning

For maximum effectiveness of license plate recognition, a camera supporting this functionality should be installed in a suitable manner, so that the images of the plates on cars are appropriately captured. Depending on the manufacturer, the LPR functionality may be also named ALPR (Automatic License Plate Recognition) or ANPR (Automatic Number Plate Recognition). There can be differences in requirements for placing the cameras and the required numbers of pixels. Before choosing the installation place, the user should consider some guidelines that must be met, such as the right viewing angle of the camera, the distance at which the camera should be mounted to the site of detection, and the corresponding size of the license plate in the image. Here are some common installation requirements for Hikvision cameras dedicated for license plate recognition.

- The width of the image of license plate should be within 130 - 300 pixels (optimum: 150-200 pixels)
- Maximum vertical viewing angle: 30°
- Maximum horizontal viewing angle: 30°
- The angle difference between the horizontal edge of the image and the horizontal edge of the plate (tilt) should not exceed +/-5°

1. The width of the image of a license plate, camera viewing angles, detection area.

To calculate the number of pixels that represent the registration plate in the frame, camera viewing angles, the height and width of the scene observed by the camera at a given distance - the necessary information includes the size and resolution of the sensor, focal length of the lens, and the distance from the camera to the object (point of detection). Below there is a table with dimensions of selected types of image sensors.

Type | Length [mm] | Width [mm] | Diagonal [mm] |

1/4" | 3.200 | 2.400 | 4.000 |

3.580 | 2.688 | 4.800 | |

1/3" | 4.800 | 3.600 | 6.000 |

1/2.7" | 5.270 | 3.960 | 6.592 |

5.370 | 4.035 | 6.721 | |

1/2.5" | 5.760 | 4.290 | 7.182 |

1/2" | 6.400 | 4.800 | 8.000 |

1/1.8" | 7.176 | 5.319 | 8.932 |

The example calculations will be performed for the currently most popular 1/3" sensors with dimensions 3.6 mm x 4.8 mm. In the case of other sensors, the calculations are similar.

A sketch of 1/3" image sensor

Short analysis of the field of view of sensor-lens optical systems

Vertical field of view in relation to the height of the sensor

Horizontal field of view in relation to the width of the sensor

Key:

- h - height of the sensor,
- H - vertical field of view,
- f - focal length of the lens,
- z - distance between the lens and the object,
- Φ
_{h}- vertical viewing angle, - O - lens,
- m - width of the sensor,
- M - horizontal field of view,
- Φ
_{m}- horizontal viewing angle, - R
_{h}- vertical sensor resolution, - R
_{m}- horizontal sensor resolution, - P
_{m}- the number of pixels representing license plate horizontally, - P
_{h}- the number of pixels representing license plate vertically.

To calculate the vertical viewing angle of the camera we can use the tangent of the Φ

_{h}angle.The calculations for the horizontal viewing angle will be similar, so that the final formula will take the following form:

The vertical viewing angle can also be calculated as the function of the z distance from the lens to the object and the vertical field of view of the camera at this distance, H. The operations are as follows:

The calculations for the horizontal viewing angle will be similar, so that the final formula will take the following form:

The formula for the vertical field of view can be derived by comparing together two formulas, tg(Φ

_{h}/2) = (H/2*z) and tg(Φ_{h}/2) = (h/2*f)The calculations for the width of the camera field of view will be similar, so that the final formula will take the following form:

With the standard width of license plates in Europe, 0.52 m, the formula for calculating the number of corresponding pixels located horizontally, depending on the horizontal resolution of the sensor, takes the following form:

Similarly, with the standard width of license plates in Europe, 0.114 m, the formula for calculating the number of corresponding pixels located vertically, depending on the vertical resolution of the sensor, takes the following form:

In the case of a camera that has already been installed, there is a simple way to check how many pixels in the image (frame) represent the license plate using e.g. Microsoft Paint computer graphics app. To do this, the user should take a screenshot of the camera image and paste it into the graphical editor. After marking the area of the plate, the bottom bar will provide information on the numbers of the corresponding pixels, horizontally and vertically. Having the information, the user can adjust the focal length of the camera to fulfill the requirements for proper recognition.

- 1 - select the marking option,
- 2 - mark the borders of the license plate,
- 3 - read the number of pixels in the image - the first value is the number of pixels horizontally (214 pix), the second vertically (62 pix).

2. The vertical angle of the camera and basic distances.

All distances, which are necessary for proper installation of the camera can be calculated using simple trigonometric functions. The vertical angle α between the longitudinal axis of the camera and the plane on which the vehicle moves (ground), should not exceed 30°. We denote the height of the camera installation point as x, the distance from the point to the place of detection (counting on the ground, as the actual distance is z) as y, and assume that the vertical angle α is 30°. We can derive the following formulas:

Diagram illustrating the positioning of an LPR camera in the vertical plane: x - the height of the camera mounting location, y - the horizontal distance between the mounting location and detection point (measured on the ground), z - the distance from the camera to the detection point, α - the vertical angle.

a) Calculation of the height of the camera mounting location with the assumed vertical angle and the horizontal distance between the mounting location and detection point.

b) Calculation of the horizontal distance between the mounting location and detection point with the assumed vertical angle and the height of the camera mounting location.

c). Calculation of the vertical angle with the assumed height of the camera mounting location and the horizontal distance between the mounting location and detection point.

3. The horizontal angle of the camera.

The horizontal angle β between the longitudinal axis of the camera and the longitudinal axis of the vehicle (or its movement direction) should not exceed 30°.

Diagram illustrating the positioning of an LPR camera in the horizontal plane. The horizontal angle β should not exceed 30°.

4. The tilt of the plate.

The angle difference between the horizontal edge of the image and the horizontal edge of the plate (tilt) should not exceed +/-5°. If the vehicle is traveling on a side inclined surface, it must also be taken into account when installing the camera.

Diagram illustrating the maximum tilt of the plate relative to the horizontal plane of the camera

4. Example.

Calculate the height x of a camera with 1/3" image sensor with resolution of 1920x1080 pixels, to preserve the vertical angle of 30°. The horizontal distance y (on the ground) from the detection point to the camera pole is 5.2 m. What will be the actual distance z from the camera to the place of detection? What are the camera viewing angles, assuming that its focal length f = 6 mm? What area will be seen by the camera at the distance z? How many pixels will represent the registration plate horizontally and vertically, if its dimensions are 0.52 m and 0.144 m, respectively? Will these numbers be sufficient for proper license plate recognition, i.e. between 130 and 300 pixels in the horizontal plane?

Calculation of the height of the camera installation:

Calculation of the actual distance z from the camera to the place of detection:

Calculation of the horizontal viewing angle (f=6 mm):

Calculation of the vertical viewing angle (f=6 mm):

Calculation of the width of the camera field of view:

Calculation of the height of the camera field of view:

Calculation of the number of pixels representing license plate in the horizontal field of view:

Calculation of the number of pixels representing license plate in the vertical field of view:

Assuming the 30° vertical angle and the horizontal distance from the detection point to the camera of 5.2 m, the camera should be mounted 3 meters above the ground. The distance z from the camera to the point of detection is 6 m. With 6 mm focal length of the camera lens, the viewing angles are 43.6° (horizontally) and 33.38° (vertically). The corresponding width and height of the field of view at the distance z are 4.8 m and 3.6 m, respectively. With the size of the registration plate of 0.52 x 0.144 m and the use of 1/3" image sensor with resolution of 1920x1080 pixels, the plate will be represented by 208 pixels horizontally and 34 pixels vertically. These values are sufficient for proper functioning of license plate recognition.