# A Road Behavior Pattern-Detection Model in Queretaro City Streets by the Use of Shape Descriptors
## 2 Materials and Methods
### Features Extraction

Table 2: List of geometric characteristics. \begin{table}
\begin{tabular}{c c c c c c c c c c c c c} \hline \hline
**OBJ** & **AREA** & **PERIMETER** & **X** & **Y** & **STDX** & **STDY** & **CIR** & **EULER** & **HARRIS** & **MHU1** & **MHU2** & **MHU3** & **MHU4** \\ \hline
1 & 62 & 27.589 & 69.806 & 97.323 & 2.9578 & 1.8087 & 0.80645 & 1 & 2 & 0.20291 & 0.01238 & 0.00286 & 0.01120 \\
2 & 37 & 19.81



Figure 4: Histogram of trajectories. In subsections: (**a**) the histogram, the \(x\)-axis is a numerical line that visualizes the range of values of trajectories in the images that have been divided into ranges of numbers or bins (nBins = 100, changing the number of bins allows to see more or less detail in the structure of the data). A bar is drawn for each bin where the width of the bar represents the number density range of the bin, and the height of the bar represents the number of trajectories included in that range; (**b–d**) it can be seen that the most representative paths and the most common trends of the trajectories are concentrated in a range of values from approximately 30 to 110 sampling points. ### Causality Analysis

The following figures (see Figures 5 and 6) show the result of applying the k-means clustering algorithm to the data set of the trajectories of the objects of each camera belonging to the experiment scenario. This grouping allows us to distinguish trajectories by some non-obvious characteristic, such as the type of movement, mode of transport, or activity carried out. As the traffic dynamics are changing, the square correlation (\(R\)) \"\(n\times n\) matrix\" is used to find the correlations of the flow intensity, which in this case is through geometric measurements/characteristics (see Figures 7 and 8). Based on Section 2.4, a correlation close to zero means no relationship, but high or maximum local correlations in their absolute values represent indications of a positive or negative relationship. Figure 5: Result of k-means clustering of object trajectories with elbow point value \(k=5\), represented with different colors. Figure 6: View of the grouping of trajectories in the experimentation scenery. ### External Dependence Model

Based on the results of the correlation matrices, we proceed to illustrate a situation with a high correlation (see Figure 9), in this case using camera \(c_{3}\) with the highest correlation, which represents this correlation at certain changes; thus, the dependency model is observed. The present results seek to find distantly related states; therefore, below, the high positive and negative correlations that are not within the same chamber are shown (see Figure 10). Figure 8: Dendrogram of geometric characteristics in the cameras \(c_{1},\ c_{2},\) and \(c_{3}\). Figure 7: Correlation coefficient of geometric characteristics in cameras \(c_{1},\ c_{2},\) and \(c_{3}\). Figure 9: Dependency model for a situation with high correlation in camera \(c_{3}\). This means that this relationship shows, when a flow is observed from the first state, which state will be associated with it and will be affected by that change in the flow (see Table 4). Low probabilities simply mean that this dependence is not always visible; only when there are peaks, which in certain situations are when there are many vehicles, are these dependencies observed, which is why they are close to zero. * High positive correlations: if the correlation value is high and positive, it means that the direction of the flow of the vehicles is downward (they go down), that is, if there is flow in camera \(c_{1}\), proportionally there will also be flow in camera \(c_{2}\). * High negative correlations: negative values represent a flow change; if high, it means that the number of vehicles decreases (opposite flow). Now, two distant cameras and two different states represent the cause-effect relationships that could occur within the avenue itself (all those that have a high positive correlation are identified).