# A Road Behavior Pattern-Detection Model in Queretaro City Streets by the Use of Shape Descriptors
## 2 Materials and Methods
### Features Extraction  
The feature extraction (\(T\), geometric measurements) was determined from the information related to the moving objects and the fixed objects. Thus, each particular position of the pixels in the image is \(x=[x_{1},y_{1}]\) and is indexed as \(I_{i}(x)\) for the dimensions of the images \(k\times l\). To characterize the behavior dataset, methods provided by the following references [50,51] were employed. Then, the geometric measurement extraction algorithm worked from a sequence of images expressed as \(\{I_{0},\ldots,I_{n}\}\). The extraction pseudocode is shown in Algorithm 1, and its purpose is to generate a dataset. Figure 1: Data acquisition methodology to be followed in the characterization of the behavior of the study scenery. Figure 2: Geographic location of inspection points. ```
Input & Image sequence \(I^{t}\)
``` Output & Geometric measurements \(T\) ```
set intensity criterion;  set radius of the structuring object;  set connectivity pixel; while has a sequence \(I^{t}\)then  get image(i);  set image(i) to grayscale;  set image(i) to normalize;  set background model;  set pixel intensity criterion;  set morphological process;  [L,n] = get moving objects; for each object found n then  xy = get connected components;  axr = calculate the area;  per = calculate the perimeter;  cry = find the centroid in x,y;  cir = calculate the circularity value;  eul = find Euler's number;  std = calculate the standard deviation in x,y;  [m1,..., m?] = calculating Hu's inv. moments;  [n,coord,puntos] = detect Harris corners;  save and insert to T dataset;  end  return T;  end
```

**Algorithm 1**Pseudocode employed for geometric feature extraction. ### Time Series

To find time series, representative routes and trends on trajectories were identified. Thus, a histogram was built to represent and visually summarize the trajectory distribution of the objects. The data employed in the histogram construction were the measured frequency of the pixels (trajectories). ### Causality Analysis

Clustering was used to identify representative routes and common trends of several trajectories. Then, graph clustering algorithms were employed to find subgraphs as representative routes or centroids. Then, the groups were formed according to the similarity of the trajectories to those centroids. After the clustering and correlation were performed, the \(k\) value procedure was performed to obtain graphical information for its calculation, thus distinguishing between trajectories by some non-obvious characteristic, such as the type of movement, mode of transportation, or activity. The correlation was classified as follows:

If \(r=1\): perfect positive correlation. If \(0<r<1\): it reflects that there is a positive correlation. If \(r=0\): in this case, there is no linear relationship. If \(-1<r<0\): there is a negative correlation. ### External Dependence Model

This model consists of finding the temporary relationships to build a graph where a relationship has a higher associated likelihood to be observed within a time interval. It means that, if a time series causes another, the knowledge of the first series could help to predict the future values of the other (after the influence of the other variables). Here, the main contribution is to find automatic relationships by using a simple camera. The above is obtained by following the model proposed in reference [33]. ## 3 Results

A system is implemented where moving objects are analyzed and categorized (characterized) by the shape and attributes observable in the movement. A set of algorithms is introduced that help us quantify moving objects over time, and from the evidence (generated database) of the set of cameras, \(c_{i}\in C\), a state-based and probabilistic model is created that defines the main movement zones and finds the temporal patterns of behavior \(P(I_{k},I_{l})\) for \(I_{K},I_{L}\in c_{i}\), which are related to the semantics of the scenario that is useful for analysis; the patterns are the result of associating through causal relationships.