# Early Fire Detection on Video Using LBP and Spread Ascending of Smoke
## 2 Proposed System
### Motion Detection  
The smoke, although sometimes not visible, is always moving because it is warmer than the surrounding air and presents an ascending and expansive movement as well as agglomerations. This movement is very special and can be subjected to extensive analysis to evaluate the influence of several factors that affect the precise detection of the movement: partial occlusions, repetitive motion and low contrast. For instance, at the limits of the smoke cloud, it tends to be diluted with an increased transparency, camouflaging the background, while, within the cloud, under some lighting conditions and in certain regions, the smoke has a uniform intensity. A hybrid algorithm for smoke motion detection is proposed, which combines a buildup of the absolute differences between consecutive frames with an adaptive background subtraction. In this way, it is possible to compensate the limitations of each technique due to the fact that the background subtraction is very sensitive to dynamic changes of lighting conditions. Besides that, it is also very sensitive to subtle movements and effective for detecting smoke in the presence of light, where it is almost transparent. Because the mean accumulation of differences between frames (\(D(x,y)\)) and background extraction (\(D_{F}(x,y)\)) are robust to changes in lighting and highly adaptable to dynamic changes, the movement detection is done as follows:  
\[D(x,y)=\frac{\sum_{t=1}^{\tau}|I_{t}(x,y)-I_{t-1}(x,y)|}{\tau-1} \tag{1}\]  
\[D_{F}(x,y)=|B_{\tau}(x,y)-I_{t}(x,y)| \tag{2}\]  
\[B_{\tau}(x,y)=\left\{ \begin{array}{ll}\alpha B_{\tau}(x,y)+(1-\alpha)I_{ \tau}(x,y)&\text{estationary}\\ B_{\tau}(x,y)&\text{movement}\end{array} \right. \tag{3}\]  
where \(I_{t}(x,y)\) is the intensity value of the pixel at position \((x,y)\) of the \(t\)th frame of the image sequence \((1<t\leq\tau)\), \(\tau\) is the number of frames to be considered in the sequence, \(B_{\tau}\) is the image adaptable background, and \(\alpha\) is a time constant that determines how fast the new information replaces the previous observations. \[U=\left\{ \begin{array}{ll}\mu(D)+\sigma(D)&\text{if}\quad U^{min}\leq\mu(D) +\sigma(D)\leq U^{max}\\ U^{min}&\text{if}\quad\mu(D)+\sigma(D)<U^{min}\\ U^{max}&\text{if}\quad\mu(D)+\sigma(D)>U^{max}\end{array} \right. \tag{4}\]  
\[U_{F}=\left\{ \begin{array}{ll}\mu(D_{F})+\sigma(D_{F})&\text{if}\quad U_{F} ^{min}\leq\mu(D_{F})+\sigma(D_{F})\leq U_{F}^{max}\\ U_{F}^{min}&\text{if}\quad\mu(D_{F})+\sigma(D_{F})<U_{F}^{min}\\ U_{F}^{max}&\text{if}\quad\mu(D_{F})+\sigma(D_{F})>U_{F}^{max}\end{array} \right. \tag{5}\]  
\[D^{\prime}(x,y)=\left\{ \begin{array}{ll}1&\text{if}\quad D(x,y)>U\\ 0&\text{otherwise}\end{array} \right. \tag{6}\]  
\[D^{\prime}_{F}(x,y)=\left\{ \begin{array}{ll}1&\text{if}\quad D_{F}(x,y)>U_ {F}\\ 0&\text{otherwise}\end{array} \right. \tag{7}\]  
\[M(x,y)=\left\{ \begin{array}{ll}1&\text{if}\quad D^{\prime}(x,y)\lor D^{ \prime}_{F}(x,y)\\ 0&\text{otherwise}\end{array} \right. \tag{8}\]  
where \(\mu\) is the mean and \(\sigma\) is the standard deviation of \(D\) and \(D_{F}\). \(U\) and \(U_{F}\) are the threshold value for \(D\) and \(D_{F}\), respectively, which are within the interval defined by \([U^{min},U^{max}]\), \([U_{F}^{min}andU_{F}^{max}]\). The thresholds \(U^{min},U^{max},U_{F}^{min}\) and \(U_{F}^{max}\) were determined experimentally using cross-validation. Operator \(\vee\) corresponds to the logical operator \"OR\". The result is an \(M(x,y)\) binary image where the pixels with movement correspond to logical 1. Several sequences of images, taken in different scenarios, were analyzed, since lighting factors showed marked variations in each scenario andcomplex situations. These factors are also variations with common noises present in motion detection, in particular reflections and shadows.