# Early Fire Detection on Video Using LBP and Spread Ascending of Smoke
## 2 Proposed System
### Color Detection  
Color is an important feature of most objects in the real world, thus provides important additional information about an object under analysis. The color of smoke depends on several factors: the temperature of combustion, the combustible material, and the lighting, among others. However, in uncontrolled combustion, smoke usually presents colors ranging from light colors due to micro-droplets produced during combustion without flame and pyrolysis of fuel, to black due to the carbonaceous solid particles or soot produced during combustion with flames [11]. In [1], it is established that the smoke varies from white to bluish white smoke when the temperature is low and black-gray to black when combustion presents flames. This observation is the guideline for determining a suitable threshold that restricts the very dark tones, because the main objective of this research is to detect fires in the early stages of combustion. The characteristic color of smoke together with the movement serves to segment more specific regions. In the RGB color space, gray colors are located on the diagonal between black and white, thus the values of the three RGB components should be similar to each other. To detect the characteristic color of smoke, the following rules are defined:  
1. The absolute difference of the maximum and minimum values among the three components (RGB) must be less than a predetermined threshold \(U_{1}^{c}\).
2. The average of the three components must be greater than the threshold \(U_{2}^{c}\).  
The first rule allows us to detect gray colors defined in Equation (10). The second rule defines the range of colors, especially very dark colors, defined by Equation (11).  
\[C^{R}(x,y)=\left\{\begin{array}{ll}1&\text{if}\quad|\max(R(x,y),G(x,y),B(x,y ))-\min(R(x,y),G(x,y),B(x,y))|<U_{1}^{c}\\ 0&\text{otherwise}\end{array}\right. \tag{10}\]  
\[C^{P}(x,y)=\left\{\begin{array}{ll}1&\text{if}\quad\frac{R(x,y)+G(x,y)+B(x, y)}{3}>U_{2}^{c}\\ 0&\text{otherwise}\end{array}\right. \tag{11}\]  
where \(C^{R}\) and \(C^{P}\) are the conditions that must be satisfied for gray and dark colors, respectively; \(U_{1}^{c}\) and \(U_{2}^{c}\) are thresholds used for determining gray and dark colors, respectively. and \(R(x,y)\), \(G(x,y)\) and \(B(x,y)\) are the values of the color components at the previously segmented position \((x,y)\) of the region with movement.  
The optimal thresholds used for color detection were found to be \(U_{1}^{c}=30.70\) and \(U_{2}^{c}=89.04\), respectively, where the first one was obtained by the ratio between the mean of intensity and the first standard deviation, while the second one was calculated subtracting the first standard deviation from the mean intensity. Thus, a pixel is considered to have a smoke-like color if Equations (10) and (11) are satisfied simultaneously:  
\[C^{H}(x,y)=\left\{\begin{array}{ll}1&\text{if}\quad C^{R}(x,y)\wedge C^{P}( x,y)\\ 0&\text{otherwise}\end{array}\right. \tag{12}\]  
Color detection is performed only in the regions in which some movement has been detected in the previous stage. Figure 3 shows the evaluation results in which the proposed system is required to detect the color of smoke. Evaluation results show that, in most cases, an accurate detection is achieved, although, in some instances, when the smoke regions are highly transparent, such that the background color is more noticeable than the color of smoke and therefore the region under analysis does not meet the established rules, the system fails to accurately detect the color of smoke.