## 4 Congestion-Avoidance and Vehicle-Detection Modules of ACO-PT for Vehicles
### Automatic-Vehicle-Detection Module
#### 4.2.4 Blob Detection  
To improve image recognition, blob detection aims to detect and locate blobs (i.e., regions of interest) in an image. Blobs are typically defined as regions of an image that are distinguishable from the surrounding pixels based on their color, texture, or intensity. We start by applying the first derivative of the Gaussian filter \(G_{ft}\), which is inversely proportional to the size of dark pixels \(D_{p}\) and can be calculated as follows:  
\[G_{ft}=\frac{1}{D_{p}\sqrt{2*\pi}} \tag{29}\]  
The second derivative of the Gaussian filter, called the Laplacian operator, must be multiplied by \(\sigma\) to obtain the response-scale invariance of vehicle \(\
abla^{2}_{norm}g\), which can be determined as follows:  
\[\
abla^{2}_{norm}g=\sigma^{2}\Bigg{(}\frac{\partial^{2}g}{\partial^{2}x}+ \frac{\partial^{2}g}{\partial^{2}y}\Bigg{)} \tag{30}\]To obtain the best response, the Laplacian zeros denote that the pixel boundaries \(B_{p}\) must be circle aligned, which is given by:  
\[B_{p}=(x^{2}+y^{2}-2\sigma^{2})e^{-\frac{x^{2}+y^{2}}{2\sigma^{2}}} \tag{31}\]  
In this case, the maximum response or external area of interest pixels \(\zeta\) in a scale can be determined as follows:  
\[\zeta=\frac{r}{\sqrt{2}} \tag{32}\]  
where \(r\) is the distance between pixels. Due to some additional factors, such as occlusions and shadows, the constructed blob model might give inappropriate results. To obtain this model, additional information must be supplied: position, width, and height. Additionally, geometric transformations should be applied to discard vehicle positions in inappropriate places. This computation obtains the distance of the vehicle blob with pixel coordinates (x, y) for an appropriate distance \(r_{ap}\) and can be obtained as follows:  
\[r_{ap}=h*\frac{f*\cos\theta+y_{o}*\sin\theta}{f*\sin\theta-y_{o}*\cos\theta} \tag{33}\]  
**Corollary 3**. : _The duration of the intermediate cycle should be such that a car approaching a highway intersection on a green signal at the speed of free movement can either stop at the stop lines or have time to freely pass through the intersection when the signal changes from green to yellow. Considering the constant deceleration experienced when braking in front of the stop line, the duration of the intermediate cycle is given by:_  
\[t_{i}=\frac{v}{2*a}+\frac{l_{s}+l_{v}}{v} \tag{34}\]  
_where \(t_{i}:\) the intermediate cycle time, \(v\): vehicle velocity, \(a\): vehicle stopping acceleration, \(l_{s}:\) the length of the stop line, and \(l_{v}:\) vehicle length._  
**Theorem 1**. : _In the period of the intermediate cycle, pedestrians who had previously crossed the carriageway at a permitting traffic light also end their movement. During time \(t_{p}\), the pedestrian must either return to the sidewalk from where they began to move or reach the middle of the carriageway. The time for a pedestrian to cross the road is:_  
\[t_{p}=\frac{B}{4*v_{p}} \tag{35}\]  
_where \(B\) is the width of the road and \(v_{p}\) is the precalculated average speed of the pedestrian._  
This approach is based on image-processing methods that calculate the number of vehicles \(V_{n}\) in both streets and set the appropriate traffic-light switching times accordingly. **Definition 5**. : _Phase coefficients are necessary to determine the duration of the main traffic-light cycles of regulation:_  
\[y_{i}=\frac{N_{i}}{M_{j}} \tag{36}\]  
_where \(y_{i}\) is the phase coefficient of the given direction, \(N_{i}\) is the traffic intensity for the considered period of time, and \(M_{j}\) is the density of traffic flow in the given direction of the control phase._The duration of the regulation cycle should be calculated, which helps to determine the hop distance of the vehicle. \[T=\frac{\sum C_{i}}{1-(y_{1}+y_{2}+\ldots+y_{n})} \tag{37}\]  
where \(T\) is the duration of the intermediate cycle, \(\sum C_{i}\) is the summation of all intermediate cycles, and \(y_{n}\) is the phase coefficient.