Calculating the longitudinal and vertical displacements of a moving object by digital image processing methods

. In the article, algorithms for calculating the longitudinal and vertical displacement of a moving object relative to a stationary base by a non-contact method using a laser-optical measuring de-vice are described and compared. The problem of non-contact measurement of longitudinal and vertical displacement belongs to the class of problems solved by methods of computer vision - image processing for measuring physical quantities. Two methods of calculating the value of the longitudinal and vertical displacement are compared. The first is based on the distance to the object, the size of the image sensor using the thin lens equation. The second is based on the method of calculus of distance to the object and the angle of view of the video recorder using the tangent formula. The measurements were carried out for the range of 0.5 - 500 m. The results of the work can be used to create high-precision positioning systems and high-precision vehicle guidance systems for various types of transport (sea, river, road, air and rail). Such systems solve the problem of stabilizing the position of moving objects in various transport systems, as well as position control.


Introduction
One of the tasks of computer vision is the task of image processing for the non-contact measurement of physical quantities. For example, non-contact high-precision measurement of longitudinal, lateral and vertical displacement of a moving object, taking into account the peculiarities of its size, shape, speed of maneuvering, speed of movement. The proposed work contains a description of the approach to solving such problems. The work proposes algorithms for calculating the longitudinal and vertical displacement of a moving object relative to a stationary base by a non-contact method using a laser optical meter [1].

Methods and materials
A laser optical meter is a software and hardware complex that includes a laser rangefinder, an array of digital video recording devices with variable focal length lenses (zoom lenses) and a microcomputer for processing measured data. In total, the laser optical meter contains three video recording devices that work alternately depending on the distance to the object. With the help of different video recording devices, it is possible to ensure sufficient clarity of images at different distances to the object at all stages of measurements.
Using non-contact method, the laser optical meter detects three types of displacement: longitudinal, transverse and vertical.
The calculation of the lateral displacement is based on a comparison of the phases of the laser signal and the signal reflected from the object. The propagation delay results in a phase difference in the signal. This difference between phases is measured. The laser works constantly, its radiation is amplitude modulated by a signal of a certain frequency [2]. The phase of the reflected signal is compared with the phase of the reference signal [3,4].
To calculate the longitudinal and vertical displacement, key points are selected on the image of the measured object, their movement is tracked, the difference between the displacement of these points and information about the distance to the object is analyzed.
In the algorithms for calculating the longitudinal and vertical displacement, such characteristics of video recording devices as, for example, focal length and view angle are used. Therefore, to avoid ambiguity in terminology, we will define the concepts that will be used further in the text of this work.
The terminology used in the description of the stages of image formation on the matrix of the video recorder ( Fig. 1) is important for understanding the algorithms described in the work. The luminous flux (9), emitted or reflected by the target, is refracted twice in the lens at the interface between two media (air, glass) at the entrance to the lens and at the exit. The refracted light rays intersect at point (6) and fall on the focal plane (7) (on this plane, the matrix of the video recording device is installed), the biconvex lens turns the image of the target. All rays of light parallel to the main optical axis (8) are collected on the focal plane, i.e. in focus (3) [5,6]. Point (6) -intersection of specific rays of light (9) (Fig. 2). Light rays passing through a biconvex lens intersect at different points (4) due to optical aberrations, some degree of distortion introduced by the lens. The picture above is an example of spherical aberration. Spherical aberration occurs due to the mismatch of the points of intersection of light rays passing at different distances from the main optical axis, while the light beam remains radially symmetric.
The zoom focal length is defined as the distance from the back main point to the focal plane (3). The back main point is one of six characteristics that are used to describe the optical system (front and back focus, front and back nodal points, front and back main points). Since zoom lenses are made up of a set of lenses, the back main point can be inside or outside the zoom lens, depending on the optical design (Fig. 3). Ray (a) -(b), passing through the lens, is refracted (Fig. 4). The point of intersection (f2) of the refracted ray with the main optical axis in the image space is called the back focus. The point of intersection (f1) of the ray (a') -(b') with the main optical axis in the space of objects is called the front focus. The points (Fig. 5) in which the ray does not change direction are called the front (s) and back (s') nodal points. The main planes of the lens pass through the nodal points (s) and (s'), for which the linear magnification is equal to unity, i.e. a linear object is equal in size to its image and is equally directed relative to the main optical axis.

Discussion
The view angle is the visible field (space) in front of the video recorder, which falls on the matrix and becomes an image, i.e. the angular size of the visible field (Fig. 7), measured horizontally, vertically, or diagonally. The view angle depends on the focal length and matrix format of the video recorder and is determined by the formula (1): ( 1 ) Let's convert angle of view from radians (DFOV) to degrees (DFOV') (2): where DFOV' -diagonal view angle (degrees), d -sensor diagonal size (matrix of a video recorder) (mm), f -focal length (mm). 180 where HFOV' -horizontal viewing angle (degrees), VFOV' -vertical viewing angle (degrees).

Results
Knowing the distance to the object (determined using a laser rangefinder) and the size of the matrix of the video recording device, it is possible to calculate the correspondence of one pixel of the image to the required unit of measurement (meters, millimeters, etc.) (Fig.  8, Fig. 9). For example, the calculation of the value of the vertical displacement (14): where H -the value of the vertical displacement, H' -the number of matrix pixels, which corresponds to the value of the vertical displacement, d -the distance from the target to the lens (mm), v -the distance from the matrix to the lens (mm). From a thin lens formula (15): where f -lens focal length, Since the size of the image is set in pixels, the vertical displacement will be obtained in pixels. In order to convert to the desired unit of measurement, it is necessary to know the linear size of the pixel, for example, the size of the pixel in mm. Depending on the linear size of the matrix, the linear pixel size will change.
The linear pixel size will be determined as (18): where f -focal length, α -horizontal view angle -H or vertical -V. The second method for calculating the value of the longitudinal and vertical displacement of an object based on the distance to the object and the view angle of the video recording device (Fig. 10) using the tangent formula is the ratio of the opposite leg to the adjacent leg in a right-angled triangle (19). The horizontal angle of view is used to calculate the longitudinal displacement, and the vertical angle of view is used to calculate the vertical displacement.  Both methods were tested on objects of no more than 50 cm in width and height and at a distance from 0.5 m to 500 m. The distance to the object was determined by a phase rangefinder with a measurement error of ± 20 mm (standard deviation is one sigma at a distance of up to 50 m) and with additional error from distance ± 10 ppm.
Illumination ranged from 80,000 to 90,000 lux (bright sun), the experiment was conducted in natural light.
Since the method for determining the longitudinal and vertical displacement is based on computer vision methods (searching for key points, tracking the movement of an object in images, etc.), an array of video recording devices with zoom lenses with different focal lengths and types of lenses is used to obtain sufficiently clear images of an object. The measurements were carried out for the ranges of 0.5 -5 m, 50 -55 m, 140 -145 m, 320 -325 m, and 495 -500 m. A trend line was drawn from the values of the relative error, given by the power function (Fig. 11, Fig. 12), for the range 0.5 -500 m.  Approximation formulas are selected by minimizing the mean square error, i.e. by the least squares method.
Taking into account the error in measuring the range and the error in determining the magnitude of the displacement of the object in the image, the method based on the tangent formula (initial data: the distance to the object and the view angle of the video recording device) gives the highest accuracy of measurements of the longitudinal and vertical displacement of the object (Table 1). Thus, this calculation method can be recommended for determining the longitudinal and vertical displacement using a laser optical meter. ± 24 mm ± 39 mm ± 57 mm ± 70 mm The results of the work can be used to create high-precision positioning systems and high-precision guidance systems for various types of transport (water [12], road [13], air [14], and rail [15]). Such systems solve the problem of stabilizing the position of moving objects in various transport systems, as well as position control.