Measuring Vehicle Profile Size: Lidar-Based System and K-Frame-Based Methodology

At present, light curtain is a widely-used method to measure the vehicle profile size. However, it is sensitive to temperature, humidity, dust and other weather factors. In this paper, a lidar-based system with a K-frame-based algorithm is proposed for measuring vehicle profile size. The system is composed of left lidar, right lidar, front lidar, control box and industry controlling computer. Within the system, a K-frame-based methodology is investigated, which include several probable algorithm combinations. Three groups of experiments are conducted. An optimal algorithm combination, A16, is determined through the first group experiments. In the second group experiments, various types of vehicles are chosen to verify the generality and repeatability of the proposed system and methodology. The third group experiments are implemented to compare with vision-based methods and other lidar-based methods. The experimental results show that the proposed K-frame-based methodology is far more accurate than the comparative methods.


Introduction
In recent years, researches about intelligent transportation system has been developing rapidly and various research results have been widely applied, which are changing and affecting our life day by day. With the continuous improvement of various performances of automobiles, higher and higher requirements have been put forward for automobile performance detection technology. With the increasing of performance parameters, more and more kinds of testing instruments and equipment are needed and they are developing towards miniaturization, full-automatic and intelligent direction. These instruments and equipment can be used to the vehicle handling performance, safety and reliability, emission environmental protection and other performance indicators for a full range of testing and evaluation.
Since the vehicles are produced according to some standard, many people are not satisfied with the monotonous style, color, or size. So, some vehicles will be modified to satisfy their individual requirements, e.g., adding some parts to enlarge the size to load more materials, etc., which may bring safety hazards like permanent damage to the road, accident and influence on normal driving. To avoid hidden dangers caused by illegal modification, all kinds of vehicles especially trucks need to be regularly measured at the inspection station. Nowadays, several methods such as Coordinate Measuring Machine (CMM) based method [1], light curtain-based method [2], vision-based method [3,4] and lidar-based method [5] were presented to measure the vehicle profile size. There are several limitations about the afore-mentioned methods such complex installation, harsh lighting requirements, sensitive to illuminations, high cost, etc. In this paper, a 2D lidar-based measurement system for vehicle profile size is proposed and a K-frame-based methodology is also investigated. In contrast to most afore-mentioned solutions, the proposed system measurement, complex terrain robot navigation and so on. However, 3D lidar has the disadvantages of complex installation and high cost.
Among lidar-based methods, 2D lidar also can be used to measure or model the object through cooperating with a movable mechanical device or a specific installation method. Gong et al. [17] proposed a 3D ice shape measurement technique through laser light sheet scanning. Yan et al. [18] detected 3D objects with a 2D laser scanning sensor and proposed specially designed algorithm to collect data and construction three-dimensional images. Sanz-Cortiella et al. [19] installed 2D lidar on the retractable bracket to scan the plant and build a 3D model of the plant and measure its size. Rosell et al. [20] employed remote 2D terrestrial lidars to obtain the 3D profile size of tree orchards. Keightley et al. [21] designed a system composed of linear laser sensors and other devices. The system could be moved by a rotating mechanical arm and be used to calculate the biomass of Agronomy. Dias et al. [22] proposed a 3D reconstruction technology based on the real world environment, which was based on the modification of traditional 2D lidar to simulate 3D lidar. Xu et al. [23] developed mechanical devices and motors to rotate the lidar around fixed points, of which three dimensional space data was obtained by single line lidar and 2D data was transformed into three-dimensional data. Li et al. [24] proposed a whole waveform echo decomposition method to improve the ranging accuracy of the whole waveform lidar. Niola et al. [25] showed a robot with two-dimensional lidar that could be used to reverse engineer objects. Fang et al. [26] proposed a real-time low-cost 3D sensing and reconstruction system, which was suitable for autonomous navigation and large-scale environment reconstruction. Choi et al. [27] investigated a sensing model of building structural deformation, which confirmed that the deformation measurement model based on 2D lidar may be a promising alternative. Ringdahlet al. [28] evaluated several existing diameter estimation algorithms using 2D lidar. An enhancement algorithm for compensating beam width and using multiple scans was also developed and evaluated by Bretschneider et al. [29]. Yamada et al. [30] used a 2D lidar to obtain road shape information. According to the road information, the road damage area was detected automatically. Most above-mentioned methods employed single or multi 2D lidars to obtain three-dimensional information of an object, which were usually installed on a movable mechanism and could reduce the equipment cost. However, the reliability and measurement accuracy were also reduced since the moving mechanical mechanism could not ensure a stable measurement system. So, lidar-mechanism-based solution is not suitable for the scene of measuring vehicle profile size since it is more complex and may include smoke, noise and vibration.

Structure and Principle
As shown in Figure 1, the lidar-based measurement system is composed of left lidar, right lidar, front lidar, control box and industry controlling computer. The left lidar and the right lidar are arranged in the upper left and right corner of the gantry at the entrance of the channel and the front lidar is arranged in the middle of the gantry at the exit of the channel.
The basic principle of the automated measurement system is as follows: when the head of a vehicle is detected to be entering the measurement region, lidars start collecting point cloud data of the vehicle; when the tail of the vehicle is detected to be leaving the measurement region, lidars stop collecting data. The measurement algorithm processes and analyzes the point cloud data and, finally, obtains the vehicle profile size. The workflow chart of the measurement process is depicted as Figure 2.
The installation locations of these devices are shown in Figure 3. The point cloud data collected by left, right and front lidars are transformed from TCP/IP protocol data by Ethernet switch in control box and entered into the measurement software installed in the industry controlling computer, which further calculates the length, width and height of the vehicle.     The installation locations of these devices are shown in Figure 3. The point cloud data collected by left, right and front lidars are transformed from TCP/IP protocol data by Ethernet switch in control box and entered into the measurement software installed in the industry controlling computer, which further calculates the length, width and height of the vehicle.

Automated Calibration of Lidars
The working principle of lidar is to send a laser beam to an object and then compare the received signal (object echo) reflecting back from the object with the transmitting signal. After proper processing, the distance between the lidar and object can be obtained. To measure the 3D size, the obtained original data needs to be converted into point cloud data in a coordinate system. As shown in Figure 4, a 2D rectangular coordinate system according to each lidar is set up, where the lidar is the origin, vertical downward direction of the lidar is the Y-axis and the direction parallel to the ground in the scanning plane of the lidar is the X-axis. The coordinate transformation can be obtained according to Equation (1): where, i represents the serial number of a laser beam in the scanning plane, Di means the distance between the point on the object that is hit by i-th laser beam and the lidar (origin of the coordinate system), βi is the angle between the i-th laser beam and Y-axis, (xi, yi) is the coordinate point under the coordinate system according to the reflected point on the object as shown in Figure 4.

Automated Calibration of Lidars
The working principle of lidar is to send a laser beam to an object and then compare the received signal (object echo) reflecting back from the object with the transmitting signal. After proper processing, the distance between the lidar and object can be obtained. To measure the 3D size, the obtained original data needs to be converted into point cloud data in a coordinate system. As shown in Figure 4, a 2D rectangular coordinate system according to each lidar is set up, where the lidar is the origin, vertical downward direction of the lidar is the Y-axis and the direction parallel to the ground in the scanning plane of the lidar is the X-axis. The coordinate transformation can be obtained according to Equation (1): where, i represents the serial number of a laser beam in the scanning plane, D i means the distance between the point on the object that is hit by i-th laser beam and the lidar (origin of the coordinate system), β i is the angle between the i-th laser beam and Y-axis, (x i , y i ) is the coordinate point under the coordinate system according to the reflected point on the object as shown in Figure 4. The installation locations of these devices are shown in Figure 3. The point cloud data collected by left, right and front lidars are transformed from TCP/IP protocol data by Ethernet switch in control box and entered into the measurement software installed in the industry controlling computer, which further calculates the length, width and height of the vehicle.

Automated Calibration of Lidars
The working principle of lidar is to send a laser beam to an object and then compare the received signal (object echo) reflecting back from the object with the transmitting signal. After proper processing, the distance between the lidar and object can be obtained. To measure the 3D size, the obtained original data needs to be converted into point cloud data in a coordinate system. As shown in Figure 4, a 2D rectangular coordinate system according to each lidar is set up, where the lidar is the origin, vertical downward direction of the lidar is the Y-axis and the direction parallel to the ground in the scanning plane of the lidar is the X-axis. The coordinate transformation can be obtained according to Equation (1): where, i represents the serial number of a laser beam in the scanning plane, Di means the distance between the point on the object that is hit by i-th laser beam and the lidar (origin of the coordinate system), βi is the angle between the i-th laser beam and Y-axis, (xi, yi) is the coordinate point under the coordinate system according to the reflected point on the object as shown in Figure 4. According to the working principle, laser beam scans cyclically from the position of start laser beam to that of the end laser beam with a certain frequency clockwise within a period. As shown in Figure 5, the maximal scanning angle is marked as α. According to Equation (1), (x i , y i ) can be calculated if and only if β i is known. To calculate β i , it is necessary to calculate γ that is the angle from the position of start laser beam to Y-axis, which is called the central angle, then, the installation height of the lidar, h, can be calculated.
According to the working principle, laser beam scans cyclically from the position of start laser beam to that of the end laser beam with a certain frequency clockwise within a period. As shown in Figure 5, the maximal scanning angle is marked as α. According to Equation (1), (xi, yi) can be calculated if and only if βi is known. To calculate βi, it is necessary to calculate γ that is the angle from the position of start laser beam to Y-axis, which is called the central angle, then, the installation height of the lidar, h, can be calculated. βi and h are the basic parameters for the automated measurement system of vehicle profile size. How to get the two parameters? When a lidar is working, it continually emits laser beams to the object at regular intervals within a fixed scanning period. Suppose the distance detected by the i-th laser beam between the lidar and the reflection point on the object be Di and a set of the distances be {Di|i = 0, 1, 2, ..., K − 1}, K is the total number of emitted laser beams within the scanning plane angle α. Let the angle of any two adjacent laser beams be ψ, which is a constant. Then, βi and h of the lidar can be calculated according to Equation (2). The calibration process is shown in Figure 6.  β i and h are the basic parameters for the automated measurement system of vehicle profile size. How to get the two parameters? When a lidar is working, it continually emits laser beams to the object at regular intervals within a fixed scanning period. Suppose the distance detected by the i-th laser beam between the lidar and the reflection point on the object be D i and a set of the distances be {D i |i = 0, 1, 2, ..., K − 1}, K is the total number of emitted laser beams within the scanning plane angle α. Let the angle of any two adjacent laser beams be ψ, which is a constant. Then, β i and h of the lidar can be calculated according to Equation (2). The calibration process is shown in Figure 6. According to the working principle, laser beam scans cyclically from the position of start laser beam to that of the end laser beam with a certain frequency clockwise within a period. As shown in Figure 5, the maximal scanning angle is marked as α. According to Equation (1), (xi, yi) can be calculated if and only if βi is known. To calculate βi, it is necessary to calculate γ that is the angle from the position of start laser beam to Y-axis, which is called the central angle, then, the installation height of the lidar, h, can be calculated. βi and h are the basic parameters for the automated measurement system of vehicle profile size. How to get the two parameters? When a lidar is working, it continually emits laser beams to the object at regular intervals within a fixed scanning period. Suppose the distance detected by the i-th laser beam between the lidar and the reflection point on the object be Di and a set of the distances be {Di|i = 0, 1, 2, ..., K − 1}, K is the total number of emitted laser beams within the scanning plane angle α. Let the angle of any two adjacent laser beams be ψ, which is a constant. Then, βi and h of the lidar can be calculated according to Equation (2). The calibration process is shown in Figure 6.

Status Judgment of Vehicle and Frame Data Collection
When the measurement system is started, no matter whether or not there is a vehicle that is moving into the measurement region, the three lidars will keep scanning and continuously transfer the original data frame to the measurement software. Among them, real effective ones are those collected from the time when the vehicle just enters the measurement region to that when it just leaves. So, how to determine when the vehicle enters and leaves the measurement region?
Let point cloud data frames collected by left lidar and right lidar at t moment be LP t = {(x i l,t , y i l,t )|i = 0, 1, . . . , F − 1} and RP t = {(x i r,t , y i r,t )|i = 0, 1, . . . , F − 1}, respectively. F presents the number of coordinate points in each frame, (x i l,t , y i l,t ) represents the converted reflection coordinate point of i-th laser beam collected by left lidar, (x i r,t , y i r,t ) represents the converted reflection coordinate point of i-th laser beam collected by right lidar. (x i l,t , y i l,t ) and (x i r,t , y i r,t ) are obtained via Equations (1) and (2). LP t and RP t are unified into a new coordinate system, of which the right lidar is the origin, horizontal direction is the X-axis and vertical downward direction is the Y-axis. Then, the new LP t and RP t are merged into a uniform set named P t according to Equation (3). The minimal X coordinate value, x min and maximal X coordinate value, x max , can be found according to Equation (4). Then, the rule of determining when the vehicle enters and leaves the measurement region is as follows: if (x max − x min ) ≥ w 0 is just satisfied, the vehicle is judged to have just entered the measurement region; If (x max − x min ) ≥ w 0 is always satisfied after the vehicle is judged to have entered the measurement region, the vehicle is judged to be still in the measurement region; if it changes just from (x max − x min ) ≥ w 0 to (x max − x min ) < w 0 , the vehicle is judged to just have left the measurement region.
where h 0 represents the vehicle height threshold, w 0 represents the vehicle width threshold. When the vehicle is judged to have just entered the measurement region, the measurement software begins to record the data frames until the vehicle is judged to just leave the measurement region.

Vehicle Width Measurement
Let the unified point cloud data sets collected by left and right lidar be n represents the quantity of data frames collected by left lidar and m represents the quantity of data frames collected by right lidar, (x ij , y ij ) represents the j-th point in the i-th frame, (x kv , y kv ) represents the v-th point in the k-th frame, F represents the quantity of coordinate points in each data frame. Since there may be some noise data due to the interference of dust, smoke, etc., the points near the ground or significantly higher than the vehicle must be preliminarily removed, i.e., those points in LP that meet the requirements of y ij > h 1 or y ij < h 2 will be removed. Similarly, the points in RP that meet the requirements of y kv > h 1 or y kv < h 2 are also removed. h 1 represents the upper threshold value in the Y-axis direction, which usually represents the ordinate Y-axis value near the top of the vehicle. h 2 represents the lower threshold value in the Y-axis direction, which usually represents the ordinate Y-axis value near the ground. Let the denoised point cloud dataset be L and R, respectively.
Theoretically, the vehicle width can be obtained easily by subtracting the minimum X-axis value R from the maximum X-axis value in L. However, considering that the data collections of left and right lidar are usually not synchronous, it is a problem that which two data frames in R and L should be chosen for subtraction. In addition, if the single frame subtraction method is adopted, it will bring random error. To overcome the random error caused by the asynchronous collections, a K-frame-based measurement algorithm is proposed. The principle of K-frame-based method is that point cloud data of left and right lidars is sub-grouped according to K 1 and K 2 frames, respectively, namely, each sub-group of point cloud data of left lidar includes K 1 frames and each sub-group of point cloud data of right lidar includes K 2 frames. The algorithm can be represented by Equations (5)- (7). where W represents the final result of vehicle width; L is divided into N 1 = n/K 1 sub-groups, each sub-group includes K 1 frames; N 1 = n/K 1 , K 1 is preset; similarly; R is divided into N 2 = m/K 2 sub-groups, each sub-group includes K 2 frames, K 2 is also preset; x ij represents the X coordinate of j-th point in the i-th frame in L; Θ may be a certain operation like max, min, or average, etc.; xl t represents the result value of the t-th sub-group of data frame set in XL Θ via Θ operation; XL Θ represents the result set of all N 1 sub-groups; x ks represents the X coordinate of s-th point in the k-th frame in R; Λ may be a certain operation like max, min, or average, etc.; xr t represents the result value of the t-th sub-group of data frame set in XR Λ via Λ operation; XR Λ represents the result set of all N 2 sub-groups; Γ represents a certain operation like Θ and Λ; min and max represent the minimum operation and the maximum operation, respectively. According to the above-mentioned model, different methods can be derived from different Θ, Λ and Γ, as shown in Table 1, Γ can be either Equations (8), (9), (10) or (11). In the actual measurement, it is difficult to keep the driving direction completely parallel to the lane axis. In this case, when Equations (8) and (9) are adopted for Γ, it will lead to a large error between the measured value of vehicle width and the actual one. So, Equations (10) or (11) is often employed for Γ in the actual measurement. The proposed K-frame-based method can effectively reduce the measurement error.

Vehicle Length Measurement
As shown in Figures 7 and 8, in the vehicle length measurement, the function of left and right lidar is to get the time t start when the vehicle enters the measurement region and the time t end when the vehicle leaves the measurement region. The length L 0 of the measurement region is already determined when the equipment is installed. At the moment of t start , the system collects a frame of point cloud data of the front lidar. After preliminary filtering, the X coordinate set {x start t } of point cloud data is obtained. At the moment of t end , the system also collects a frame of point cloud data of the front lidar. Similarly, after Sensors 2021, 21, 6206 9 of 17 preliminary filtering, the point cloud data X coordinate set x end t is obtained. Then, the vehicle length L can be calculated according to Equation (12).

Vehicle Length Measurement
As shown in Figures 7 and 8, in the vehicle length measurement, the function of left and right lidar is to get the time tstart when the vehicle enters the measurement region and the time tend when the vehicle leaves the measurement region. The length L0 of the measurement region is already determined when the equipment is installed. At the moment of tstart, the system collects a frame of point cloud data of the front lidar. After preliminary filtering, the X coordinate set { start } of point cloud data is obtained. At the moment of tend, the system also collects a frame of point cloud data of the front lidar. Similarly, after preliminary filtering, the point cloud data X coordinate set { end } is obtained. Then, the vehicle length L can be calculated according to Equation (12).

Vehicle Height Measurement
The algorithm of vehicle height measurement is similar to that of vehicle width measurement. Theoretically, the left or right lidar can measure the vehicle height separately, as shown in Figure 9; however, this may lead to a large error. To eliminate the measurement error, the point cloud data of both the two lidars are still fully fused and an algorithm similar to that of vehicle width measurement is advised. So, the vehicle height can be calculated according to Equation (13).

Vehicle Length Measurement
As shown in Figures 7 and 8, in the vehicle length measurement, the function of left and right lidar is to get the time tstart when the vehicle enters the measurement region and the time tend when the vehicle leaves the measurement region. The length L0 of the measurement region is already determined when the equipment is installed. At the moment of tstart, the system collects a frame of point cloud data of the front lidar. After preliminary filtering, the X coordinate set { start } of point cloud data is obtained. At the moment of tend, the system also collects a frame of point cloud data of the front lidar. Similarly, after preliminary filtering, the point cloud data X coordinate set { end } is obtained. Then, the vehicle length L can be calculated according to Equation (12).

Vehicle Height Measurement
The algorithm of vehicle height measurement is similar to that of vehicle width measurement. Theoretically, the left or right lidar can measure the vehicle height separately, as shown in Figure 9; however, this may lead to a large error. To eliminate the measurement error, the point cloud data of both the two lidars are still fully fused and an algorithm similar to that of vehicle width measurement is advised. So, the vehicle height can be calculated according to Equation (13).

Vehicle Height Measurement
The algorithm of vehicle height measurement is similar to that of vehicle width measurement. Theoretically, the left or right lidar can measure the vehicle height separately, as shown in Figure 9; however, this may lead to a large error. To eliminate the measurement error, the point cloud data of both the two lidars are still fully fused and an algorithm similar to that of vehicle width measurement is advised. So, the vehicle height can be calculated according to Equation (13).
where the calculation methods of YL Θ and YR Λ are similar to XL Θ and XR Λ .
where the calculation methods of YLΘ and YRΛ are similar to XLΘ and XRΛ. Figure 9. Illustration of how to measure vehicle height.

Calibration Error
Suppose the maximum angle of the lidar scanning plane be α and total number of Figure 9. Illustration of how to measure vehicle height.

Calibration Error
Suppose the maximum angle of the lidar scanning plane be α and total number of laser beams of each scanning cycle be K. Due to the limited number of laser beams, sometimes it is impossible to find a laser beam that coincides with the vertical direction as the Y-axis. In this case, the closest laser beam is chosen as the Y-axis, which absolutely will lead error. As shown in Figure 10, when the vertical line from lidar to ground is exactly in the middle of two laser beams, calibration error will be maximum. Under the situation, the angle value between the closest laser beam and the vertical line is α/2K. The influence of the calibration error on vehicle width measurement error is shown in Figure 11. The coordinate conversion relationship between the actually established coordinate system and the standard one with the vertical line as the Y-axis is shown in Equation (14).

Calibration Error
Suppose the maximum angle of the lidar scanning plane be α and total number of laser beams of each scanning cycle be K. Due to the limited number of laser beams, sometimes it is impossible to find a laser beam that coincides with the vertical direction as the Y-axis. In this case, the closest laser beam is chosen as the Y-axis, which absolutely will lead error. As shown in Figure 10, when the vertical line from lidar to ground is exactly in the middle of two laser beams, calibration error will be maximum. Under the situation, the angle value between the closest laser beam and the vertical line is α/2K. The influence of the calibration error on vehicle width measurement error is shown in Figure 11. The coordinate conversion relationship between the actually established coordinate system and the standard one with the vertical line as the Y-axis is shown in Equation (14). If other factors that may cause errors are excluded and the vehicle drives strictly along with the middle of the lane and the horizontal width of the left and right lidars is W0, the theoretical vehicle width is calculated according to Equation (15). In consideration of calibration error, the actual measured value is shown in Equation (16). Then, the relative measurement error of vehicle width caused by calibration error is according to Equation (17).
To eliminate the measurement error caused by calibration, a calibration object whose If other factors that may cause errors are excluded and the vehicle drives strictly along with the middle of the lane and the horizontal width of the left and right lidars is W 0 , the theoretical vehicle width is calculated according to Equation (15). In consideration of calibration error, the actual measured value is shown in Equation (16). Then, the relative measurement error of vehicle width caused by calibration error is according to Equation (17).
To eliminate the measurement error caused by calibration, a calibration object whose profile size is known is used a fine-tuning strategy is facilitated as follows: 1.
a calibration object, whose profile size is known, is measured by the proposed system; 2.
the lidars are fine-tuned according to difference value between the measured value and actual value of the calibration object; 3.
step 1 and 2 are repeated until the measured value is equal to the actual value.

Deviation Error of Vehicle Moving
As shown in Figure 12, in the basic algorithm combination of Table 1, if Equation (8) or Equation (9) is adopted for Γ and there is deflection angle between the track and the central axis when the vehicle is moving forward, the error will be relatively large. Suppose the angle between the vehicle driving direction and the central lane axis be θ, the actual value of the vehicle width be W, the measured value be W and the actual value of the vehicle length be L, the relative error of the vehicle width caused by the vehicle moving deviation is shown in Equation (18).
Then, expanding Equation (18) can be expanded to Equation (19). Usually, as for trucks, W is limited to 2.5 m, L is limited to 18 m. If the measurement error δ < 1% is required, θ < 0.08° must be satisfied; if L is limited to 13 m, θ < 0.12° must be satisfied, which means the high requirement for vehicle moving trajectory. Thus, a Kframe-based method is proposed, which can eliminate the measurement error caused by the deviation angle between the vehicle and the central axis and overcome the synchronization requirements of the left and right lidar through filtering noise data.

Determination of the Optimal Algorithm
Different combinations according to Table 1 are tested for about 800 vehicles to determine the exact measure algorithm that has the minimal measurement error profile size, where there are 102 vans, 36 barn trucks, 59 fence trucks, 20 crane trucks, 150 semi-trailer tractors and 77 buses. Average errors of vehicle width and height according to algorithm combination in Table 1 are shown in Figures 13 and 14, respectively. According to the experimental results, it can be found that the combination A16 in Table 1, i.e., Θ chooses mean method, Λ chooses mean method, Γ chooses Equation (11), can reach the minimal average error. Usually, as for trucks, W is limited to 2.5 m, L is limited to 18 m. If the measurement error δ < 1% is required, θ < 0.08 • must be satisfied; if L is limited to 13 m, θ < 0.12 • must be satisfied, which means the high requirement for vehicle moving trajectory. Thus, a K-framebased method is proposed, which can eliminate the measurement error caused by the deviation angle between the vehicle and the central axis and overcome the synchronization requirements of the left and right lidar through filtering noise data.

Determination of the Optimal Algorithm
Different combinations according to Table 1 are tested for about 800 vehicles to determine the exact measure algorithm that has the minimal measurement error profile size, where there are 102 vans, 36 barn trucks, 59 fence trucks, 20 crane trucks, 150 semi-trailer tractors and 77 buses. Average errors of vehicle width and height according to algorithm combination in Table 1 are shown in Figures 13 and 14, respectively. According to the experimental results, it can be found that the combination A16 in Table 1, i.e., Θ chooses mean method, Λ chooses mean method, Γ chooses Equation (11), can reach the minimal average error.

Determination of the Optimal Algorithm
Different combinations according to Table 1 are tested for about 800 vehicles to determine the exact measure algorithm that has the minimal measurement error profile size, where there are 102 vans, 36 barn trucks, 59 fence trucks, 20 crane trucks, 150 semi-trailer tractors and 77 buses. Average errors of vehicle width and height according to algorithm combination in Table 1 are shown in Figures 13 and 14, respectively. According to the experimental results, it can be found that the combination A16 in Table 1, i.e., Θ chooses mean method, Λ chooses mean method, Γ chooses Equation (11), can reach the minimal average error.   Table 1.  Table 1.
However, decision about which algorithm combination should be chosen can't be made just according to the average error. Considering that the number of samples of different types of vehicles in the experiment varies greatly, it is very likely that the combination with smaller average error may have smaller error only when measuring the vehicle type with larger number of samples and the error may be too large when measuring the vehicle type with smaller number of samples. Then, the standard deviation of vehicle width and height is also calculated and is depicted in Figures 15 and 16, respectively. The experiment results of the standard deviation show that A16 still reaches the minimal value. On the whole, A16 is an algorithm combination with smaller error and stronger applicability compared with other algorithms, which is determined to be the exact algorithm for measuring the vehicle profile size.   Table 1. However, decision about which algorithm combination should be chosen can't be made just according to the average error. Considering that the number of samples of different types of vehicles in the experiment varies greatly, it is very likely that the combination with smaller average error may have smaller error only when measuring the vehicle type with larger number of samples and the error may be too large when measuring the vehicle type with smaller number of samples. Then, the standard deviation of vehicle width and height is also calculated and is depicted in Figures 15 and 16, respectively. The experiment results of the standard deviation show that A16 still reaches the minimal value. On the whole, A16 is an algorithm combination with smaller error and stronger applicability compared with other algorithms, which is determined to be the exact algorithm for measuring the vehicle profile size.  Table 1.
However, decision about which algorithm combination should be chosen can't be made just according to the average error. Considering that the number of samples of different types of vehicles in the experiment varies greatly, it is very likely that the combination with smaller average error may have smaller error only when measuring the vehicle type with larger number of samples and the error may be too large when measuring the vehicle type with smaller number of samples. Then, the standard deviation of vehicle width and height is also calculated and is depicted in Figures 15 and 16, respectively. The experiment results of the standard deviation show that A16 still reaches the minimal value. On the whole, A16 is an algorithm combination with smaller error and stronger applicability compared with other algorithms, which is determined to be the exact algorithm for measuring the vehicle profile size.   Table 1.    Table 1.

Experiments of the Optimal Algorithm
Five specific vehicles from the above-mentioned five categories are chosen for the experiments to verify the applicability and repeatability of A16, which are semi-trailer tractor, van, barn truck, fence truck, crane truck and bus. The profile size of all the five vehicles is measured ten times and compared with the ground truth. The experimental results, i.e., profile size, max error, relative error and repeatability error, are shown in the Table 2. As shown in Figure 17, max errors of the experimental results are depicted as a line chart in ascending order of vehicle length. The measurement time increases according to the increasing of the vehicle length, where it is supposed that the vehicles move with similar speed. Then, errors caused slight deflection and moving deviation from central axis of the lane will be accumulated. Since it is completely different from the width and height measurement, K-frame-based method is not employed in the length measurement. In Figure 17, it can be clearly found that the max error of length also increases with the increasing of measurement time while that of width and height does not increase with the increasing of measurement time, which further proves that K-frame-based method can eliminate the error caused by moving deviation from central axis of the lane to a certain extent.

Comparison Experiments
Several comparison experiments with Li et al. [31], Robert et al. [32] and Robert et al. [33] are conducted to prove the measurement accuracy of the proposed method, where Li et al. [31] investigated a monocular-vision-based method of vehicle 3D size measurement, Robert et al. [32] designed a scheme to measure the length of moving vehicles by employing stereoscopic video analysis technology, Robert et al. [33] proposed a new method to estimate vehicle size based on active appearance model (AAM) and stereoscopic video analysis. Although most of the experimental measurement objects are passenger vehicles with only a few large vehicles, the above-mentioned three methods are still used in our comparison experiments since they behave well in the measurement of vehicle profile size. The experimental results are shown in Table 3. It can be found that the proposed Although Figure 17 shows that the max error of length will increase with the increasing of measurement time, it also can be found that the max relative error of length does not change significantly with the increasing of vehicle length. In fact, as shown in Figure 18, the max relative error of length fluctuates in a small range just similar to the max error of width and height, which shows that the proposed measurement method is of high applicability after facilitating the optimal algorithm combination A16.

Comparison Experiments
Several comparison experiments with Li et al. [31], Robert et al. [32] and Robert et al. [33] are conducted to prove the measurement accuracy of the proposed method, where Li et al. [31] investigated a monocular-vision-based method of vehicle 3D size measurement, Robert et al. [32] designed a scheme to measure the length of moving vehicles by employing stereoscopic video analysis technology, Robert et al. [33] proposed a new method to estimate vehicle size based on active appearance model (AAM) and stereoscopic video analysis. Although most of the experimental measurement objects are passenger vehicles with only a few large vehicles, the above-mentioned three methods are still used in our comparison experiments since they behave well in the measurement of vehicle profile size. The experimental results are shown in Table 3. It can be found that the proposed In terms of repeatability, it can be seen from Figure 19 that the repeatability error is confined to a small range and there is no repeatability error higher than 0.5%, which shows the proposed measurement is of good repeatability.

Comparison Experiments
Several comparison experiments with Li et al. [31], Robert et al. [32] and Robert et al. [33] are conducted to prove the measurement accuracy of the proposed method, where Li et al. [31] investigated a monocular-vision-based method of vehicle 3D size measurement, Robert et al. [32] designed a scheme to measure the length of moving vehicles by employing stereoscopic video analysis technology, Robert et al. [33] proposed a new method to

Comparison Experiments
Several comparison experiments with Li et al. [31], Robert et al. [32] and Robert et al. [33] are conducted to prove the measurement accuracy of the proposed method, where Li et al. [31] investigated a monocular-vision-based method of vehicle 3D size measurement, Robert et al. [32] designed a scheme to measure the length of moving vehicles by employing stereoscopic video analysis technology, Robert et al. [33] proposed a new method to estimate vehicle size based on active appearance model (AAM) and stereoscopic video analysis. Although most of the experimental measurement objects are passenger vehicles with only a few large vehicles, the above-mentioned three methods are still used in our comparison experiments since they behave well in the measurement of vehicle profile size. The experimental results are shown in Table 3. It can be found that the proposed method is far more accurate than the three methods. Since the principle of the proposed method is completely different from those of the three methods, the purpose of this comparison is to verify the high measurement accuracy in the similar scene. To further prove how good the K-frame-based method with the algorithm combination A16 is, additional comparison experiments with Xu et al. [34] and Xu et al. [35] are implemented. Xu et al. [34] developed a vehicle size measurement method based on monocular vision, Xu et al. [35] proposed a method of vehicle 3D dimension measurement based on laser ranging is proposed and developed a vehicle 3D dimension measurement system. Although only the experiment of dump truck is carried out [34], the application scene of is similar to that of the system in this paper. The hardware and installation scheme in [35] are very similar to ours. Those are why they are chosen for the comparison. Table 4 shows the experiment results. From Table 4, it can be found that in the similar application scenarios, the accuracy of the proposed method is higher than [34] in the similar application scenarios, which proves the correctness of lidar-based measurement equipment. According to the comparison experimental results with [35], it can be seen that the K-frame-based algorithm and the selected optimal algorithm combination A16 can greatly improve the measurement accuracy and prove the significance of K-frame-based algorithm and the selected optimal combination strategy. Overall, according to the above-mentioned experimental results, the proposed scheme and system has a high measurement accuracy in the application scenarios. Especially, the K-frame-based algorithm and the selected optimal algorithm combination A16 play important roles in improving the measurement accuracy in the system.

Conclusions
In this paper, a complete solution of lidar-based automated measurement system for vehicle profile size is developed and a method including lidar system calibration, vehicle status determination, original data processing and profile size calculation is proposed, which greatly reduces the influence of various interference factors on measurement accuracy. Especially, a K-frame-based algorithm is investigated can eliminate the measurement error caused by the deviation angle between the vehicle and the central axis when the vehicle is moving forward, at the same time, it can overcome the synchronization requirements of the left and right lidar and filter noise data. The experimental results show that, the proposed method makes a great improvement on the measurement accuracy with similar equipment under similar conditions. At the same time, the K-frame-based algorithm is not limited by hardware devices, which has a certain generality. How to facilitate the algorithm in light curtain and machine vision measurement systems is part of our ongoing work, which may reduce the influence of various interference factors on measurement accuracy and reduce measurement error.