# Multi-Adjacent Camera-Based Dangerous Driving Trajectory Recognition for Ultra-Long Highways
## 3 Methodology
### Anomaly Trajectory Recognition Based on Trajectory Rules
#### 3.3.3 Trajectory Acquisition Method for Visible Scenes  
In the visible range of the camera, based on the vehicle tracking results and vehicle modelling information, we can obtain accurate vehicle position information and trajectory on the time series. The positional information of vehicles in camera images is represented in the form of pixel coordinates. These pixel coordinates cannot be directly used to analyze the vehicles' trajectories in the real-world. Therefore, it is necessary to map the pixel coordinates of vehicles in camera images to their corresponding real-world coordinates, thus obtaining the vehicles' position information in the real-world. The calculation method between any point in the world coordinate system and its corresponding point in the pixel coordinate system is shown in Equation (5).  
\[Z_{c}\left[\begin{array}{c}u\\ v\\ 1\end{array}\right]=M\left[\begin{array}{c}X_{w}\\ Y_{w}\\ Z_{w}\\ 1\end{array}\right]=\left[\begin{array}{cccc}r_{11}&r_{12}&r_{13}&r_{14}\\ r_{21}&r_{22}&r_{23}&r_{24}\\ r_{31}&r_{32}&r_{33}&r_{34}\end{array}\right]\left[\begin{array}{c}X_{w}\\ Y_{w}\\ Z_{w}\\ 1\end{array}\right] \tag{5}\]  
In Equation (5), if the pixel coordinates and the world coordinates of any point are known, \(r_{34}\) can be determined as \(1\). Thus, there remain \(11\) unknowns in the projection transformation matrix M. In practical scenarios, the bridge deck can be approximated as a horizontal plane in the world coordinate system. The mapping reference points between the pixel coordinate system and the world coordinate system are illustrated in Figure 4.  
When performing vehicle detection and tracking, precise vehicle location information has already been obtained. After undergoing coordinate transformation, vehicle trajectories can be accurately represented in two-dimensional space. In this section, for the extraction of vehicle trajectories, the collection of bottom center coordinates of the tracked vehicle bounding boxes in each frame is selected as the approximate travel trajectory of the vehicle. The specific process of trajectory extraction can be described as follows: The vehicle bounding boxes detected in the \(k_{th}\) frame are used as the basis for trajectory extraction.  
\begin{table}
\begin{tabular}{l l l l l l} \hline \hline
**Vehicle Behavior** & \multicolumn{4}{l}{**Mathematical Description of Downward Vehicle Behavior**} \\ \hline Normal driving & \(L>0\) & \& \& \(A>0\) & \& \(|k_{i}|>u\) & \& \(m<V_{k}<n\) \\ Wrong side & \(L>0\) & \& \& \(A<0\) & & \\ Speeding & \(L>0\) & \& \& \(V_{k}>n\) & & \\ Low speed & \(L>0\) & \& \& \(V_{k}<m\) & & \\ Stop & \(l_{i_{i}}l_{i+1},l_{i+2},\cdots\) & \(0\) & & & \\ Dangerous lane change & \(L>0\) & \& \& \(A>0\) & \& \(|k_{i}|<u\) & \\ \hline \hline \end{tabular}
\end{table}
Table 1: Mathematical model for vehicle descent, \(u\) represents the threshold for vehicle steering slope, \(m\) is the threshold for the minimum allowed speed, and \(n\) is the threshold for the maximum allowed speed.  
Figure 4: Mapping reference points in pixel coordinate system and world coordinate system.  
The bottom center coordinates are represented as shown in Equation (6),  
\[(x_{k},y_{k})=\left(d\cdot x(i)+\frac{d\cdot w(i)}{2},d\cdot y(i)+d\cdot h(i)\right) \tag{6}\]  
where \((d\cdot x(i),d\cdot y(i))\) represents the coordinates of the origin, i.e., the upper-left corner of the rectangle, and \(d\cdot w(i)\) and \(d\cdot h(i)\) denote the width and height of the rectangle, respectively. The obtained trajectory is illustrated in Figure 5.  
In the P-th camera view, the trajectory of a certain vehicle in a consecutive sequence of \(t+1\) frames can be represented by a sequence of sets containing \(t+1\) pixel coordinate points, as shown in Equation (7).  
\[P_{i}=\{(x_{k},y_{k},C_{P}),(x_{k+1},y_{k+1},C_{P}),\cdots,(x_{k+t},y_{k+t},C_{ P})\} \tag{7}\]