# Forest Fire Detection Using a Rule-Based Image Processing Algorithm and Temporal Variation

Authors: Mubarak A. I. Mahmoud; Honge Ren
Journal: Mathematical Problems in Engineering
 (2018)

---

## Abstract

Forest fires represent a real threat to human lives, ecological systems, and infrastructure. Many commercial fire detection sensor systems exist, but all of them are difficult to apply at large open spaces like forests because of their response delay, necessary maintenance needed, high cost, and other problems. In this paper a forest fire detection algorithm is proposed, and it consists of the following stages. Firstly, background subtraction is applied to movement containing region detection. Secondly, converting the segmented moving regions from RGB to YCbCr color space and applying five fire detection rules for separating candidate fire pixels were undertaken. Finally, temporal variation is then employed to differentiate between fire and fire-color objects. The proposed method is tested using data set consisting of 6 videos collected from Internet. The final results show that the proposed method achieves up to 96.63% of true detection rates. These results indicate that the proposed method is accurate and can be used in automatic forest fire-alarm systems.


---

## Body

## 1. Introduction

Forest fire detection systems are gaining a lot of attention because of the continual threat from fire to both economic properties and public safety [1]. Hundreds of millions of hectares are destroyed by wildfires each year [2] and over 200,000 forest fires happen every year in the world. Forest fires destroy a total area of 3.5 to 4.5 million km2 [3]. Increase in forest fires in forest areas around the world has resulted in an increased motivation for developing fire warning systems for the early detection of wildfires [1]. Sensor technology has been widely used in fire detection, usually depending on sensing physical parameters such as changes in pressure, humidity, and temperature, as well as chemical parameters such as carbon dioxide, carbon monoxide, and nitrogen dioxide. However, it is hard to apply these systems in large open areas for a variety of reasons such as high cost, energy usage by the sensors, and the necessary proximity of the sensor to the fire for accurate sensing resulting in physical damage to the sensors [4]. In addition, sensor methods have a high false alarms rate and their response time is quite big [5].There are numerous motivating factors for the use of an image processing based method of fire detection. The first factor is the rapid development of digital camera technology and CCD or CMOS digital cameras, which has resulted in a rapid increase in image quality and decreased cost of the cameras. The second factor is that digital cameras can cover large areas with excellent results. Third, the response time of image processing models is better than that of existing sensor models. Finally, the overall cost of image processing systems is lower than existing systems.


### 1.1. Related Studies

Several fire detection algorithms have been proposed by various researchers. Thou-Ho et al. [6] presented fire detection algorithm, which combines the saturation channel of the HSV color and the RGB color. This algorithm employs three rules (R≥G>B), (R≥RT), and (S≥ ((255-R) ∗ST/RT). Determination of the two thresholds RT and ST is required. The certain values range is from 115 to 135 for RT and from 55 to 65 for ST based on many investigational results done by the authors. This method is computationally simple compared to the other algorithms; however, it suffers from false-positive alarms in case of moving fire-like objects. Dios et al. [2] presented an optical model used to detect forest fires and measure the properties of the fire such as flame height, fire front, fire base width, and flame inclination angle. This system is very good; nevertheless, it is very expensive because it consists of infrared cameras and other technologies such as GPS and telemetry sensors. Yinglian et al. [7] proposed forest fire disaster prevention algorithm based on image processing. This algorithm depends on fire and smoke color properties to identify fire. Yinglian’s algorithm is good, but the smoke spreads quickly and it has many different colors which depend on the burning material; thus, the false alarm rate rises.In this paper, a forest fire detection algorithm is proposed. The algorithm uses YCbCr color space since it effectively separates luminance from chrominance and is able to separate high temperature fire center pixels because the fire at the high temperature center region is white. The final results show that the proposed system has good detection rates and fewer false alarms, which are the main crucial problems of the most existing algorithms.This paper is organized as follows: Section2 describes the proposed fire detection method; Section 3 presents the results and computational complexity of the proposed algorithm; and Section 4 summarizes the work that has been carried out in this study and potential future direction.


## 1.1. Related Studies

Several fire detection algorithms have been proposed by various researchers. Thou-Ho et al. [6] presented fire detection algorithm, which combines the saturation channel of the HSV color and the RGB color. This algorithm employs three rules (R≥G>B), (R≥RT), and (S≥ ((255-R) ∗ST/RT). Determination of the two thresholds RT and ST is required. The certain values range is from 115 to 135 for RT and from 55 to 65 for ST based on many investigational results done by the authors. This method is computationally simple compared to the other algorithms; however, it suffers from false-positive alarms in case of moving fire-like objects. Dios et al. [2] presented an optical model used to detect forest fires and measure the properties of the fire such as flame height, fire front, fire base width, and flame inclination angle. This system is very good; nevertheless, it is very expensive because it consists of infrared cameras and other technologies such as GPS and telemetry sensors. Yinglian et al. [7] proposed forest fire disaster prevention algorithm based on image processing. This algorithm depends on fire and smoke color properties to identify fire. Yinglian’s algorithm is good, but the smoke spreads quickly and it has many different colors which depend on the burning material; thus, the false alarm rate rises.In this paper, a forest fire detection algorithm is proposed. The algorithm uses YCbCr color space since it effectively separates luminance from chrominance and is able to separate high temperature fire center pixels because the fire at the high temperature center region is white. The final results show that the proposed system has good detection rates and fewer false alarms, which are the main crucial problems of the most existing algorithms.This paper is organized as follows: Section2 describes the proposed fire detection method; Section 3 presents the results and computational complexity of the proposed algorithm; and Section 4 summarizes the work that has been carried out in this study and potential future direction.


## 2. Materials and Methods

This section presents the proposed forest fire detection algorithm. It consists of the following main stages: the first step receives the input video from the input device; the second step applies movement containing region detection based on background subtraction (MRDB); the third step converts the input image sequence from RGB to YCbCr color space; and the fourth step applies the fire detection rules, and temporal variation. A fire alarm is activated if all detection conditions are satisfied. The proposed algorithm stages will be described in detail. Figure1 shows the proposed algorithm flowchart.Figure 1
The proposed fire detection method.


### 2.1. Movement Containing Region Detection Based on Background Subtraction (MRDB)

Detecting moving regions is a key factor in most of the video based fire detection systems because fire boundaries continuously fluctuate. So background subtraction is used to select candidate regions of fire. A pixel located at (x, y) is supposed to be moving if the following condition is satisfied [8]. (1)Inx,y-Bnx,y>thrIn(x, y) represents the intensity value of the pixel at location(x, y)in the nth gray-level for the current frame andBn (x, y) represent the background intensity value at the same pixel location, andthr is a threshold value experimentally set to 3. The background is continuously updated using (2):(2)Bn+1i,j=Bnx,y+1Bnx,y-1Bnx,yifInx,y>Bnx,yifInx,y<Bnx,yifInx,y=Bnx,ywhere Bn+1(x, y) and Bn(x, y) represent the intensity of the pixel value at location(x, y) for the current and previous backgrounds. Figure 2 shows an example of MRDBFigure 2
Example of MRDB. (a) Frame before MRDB, (b) frame after applying MRDB.
(a) (b)


### 2.2. Converting RGB Images to YCbCr

Due to the fact that different kinds of moving objects can be included after applying background subtraction, such as trees, animals, birds, and people, therefore images from the background subtraction stage are converted to YCbCr [9] to select candidate fire regions using (3). Figure 3 shows original RGB image (a) and YCbCr component. The mean values of the YCbCr channel are then calculated using (4), (5), and (6).(3)YCbCr=0.25680.50410.0979-0.1482-0.29100.43920.4392-0.3678-0.0714∗RGB+16128128(4)Ymean=1N∗M∑x=1N∑y=1MYx,y(5)Cbmean=1N∗M∑x=1N∑y=1MCbx,y(6)Crmean=1N∗M∑x=1N∑y=1MCrx,ywhere Ymean,Cbmean, and Crmean are the mean values for theYCbCr channels;Y (x, y), Cb (x, y),andCr (x, y)areYCbCr channel values for pixel at specific location(x, y);andN∗M is the total number of pixels.Figure 3
(a) An RGB image and its (Y), (Cb), and (Cr) channels.


### 2.3. Fire Color Pixel Detection Rules

In any fire image pixels, the red color value is larger than green and green is larger than blue as illustrated in Figure4: (a) is a fire image and (b) is the RGB channels histogram for the same image. This fact is represented in RGB color space as R>G>B and can be converted to YCbCr using the flowing equations:(7)Yx,y>Cbx,y(8)Crx,y>Cbx,yAlso, the Y component value is greater than the mean Y component of the same image and the Cb component is smaller than the mean Cb of same image, while the Cr component is greater than the mean Cr mean component. This fact can be represented by the flow:(9)Fx,y=1ifYx,y>Ym;Cbx,y<Cbm;Crx,y>Crm0OtherwisewhereF(x, y) can be any pixel on the image. Ym, Cbm, and Crm are the mean values for Y, Cb, and Cr, respectively.Figure 4
(a) RGB fire image and (b) the Histogram of the same image channels.
(a) (b)The Cb component as shown is predominantly “black” and the Cr component is “white”. This idea can be represented by the following equations:(10)Fx,y=1ifCbx,y-Crx,y≥τ0Otherwise(11)Fx,y=1;Cbx,y≤120⋂Crx,y≥1500Otherwisewhere τ is a constant, specified in [10] using receiver operating characteristic (ROC), by applying different values of τ in the range [1,100]. To measure the “true detection rate” and “false detection,” data sets consisting of 500 images (300 of them being images of a forest fire, 200 nonfire images) collected from Internet were used. Only (10) was used with different values of τ in the range [1,100] to detect binary images of the candidate fire region. τ was selected as τ = 70 resulting in a true detection rate of more than 90% and false detection of less than 40%.Figure5 shows the application of detection rules (7) through (11).Figure 5
Applying the rules (7)-(11) to input images: (a) original RGB images, (b) binary images using rule (7), (c) binary images using rule (8), (d) binary images using rule (9), (e) binary images using rule (10), (f) binary images using rules (7) through (11).
(a) (b) (c) (d) (e) (f)


### 2.4. Temporal Variation

Using color models alone is not enough to identify fire correctly because there are several objects that share the same fire color such as red leaves, desert, and other red moving objects. The main difference between actual fire and the fire-color objects is the nature of their motion. Shape and size of the flame are totally changeable, because of burning materials and airflow; thus, it produces higher temporal variation. In contrast, rigid bodies’ motion produces lower temporal variation. Therefore, it is possible to differentiate between the fire pixels and the fire color. To detect a fire movement, the difference between successive frames was analyzed. Suppose a video sequence consisting of n frames, and the average temporal variation is defined as [11] (12)Δx,y=1n∑i=1n-1fix,y-fi+1x,ywhere Δ(x, y) is the average temporal variation, fi(x,y) is a pixel intensity at the location(x, y) in theith frame. If Δ(x, y) >thr(experimentally determined threshold), then a moving pixel is fire.


## 2.1. Movement Containing Region Detection Based on Background Subtraction (MRDB)

Detecting moving regions is a key factor in most of the video based fire detection systems because fire boundaries continuously fluctuate. So background subtraction is used to select candidate regions of fire. A pixel located at (x, y) is supposed to be moving if the following condition is satisfied [8]. (1)Inx,y-Bnx,y>thrIn(x, y) represents the intensity value of the pixel at location(x, y)in the nth gray-level for the current frame andBn (x, y) represent the background intensity value at the same pixel location, andthr is a threshold value experimentally set to 3. The background is continuously updated using (2):(2)Bn+1i,j=Bnx,y+1Bnx,y-1Bnx,yifInx,y>Bnx,yifInx,y<Bnx,yifInx,y=Bnx,ywhere Bn+1(x, y) and Bn(x, y) represent the intensity of the pixel value at location(x, y) for the current and previous backgrounds. Figure 2 shows an example of MRDBFigure 2
Example of MRDB. (a) Frame before MRDB, (b) frame after applying MRDB.
(a) (b)


## 2.2. Converting RGB Images to YCbCr

Due to the fact that different kinds of moving objects can be included after applying background subtraction, such as trees, animals, birds, and people, therefore images from the background subtraction stage are converted to YCbCr [9] to select candidate fire regions using (3). Figure 3 shows original RGB image (a) and YCbCr component. The mean values of the YCbCr channel are then calculated using (4), (5), and (6).(3)YCbCr=0.25680.50410.0979-0.1482-0.29100.43920.4392-0.3678-0.0714∗RGB+16128128(4)Ymean=1N∗M∑x=1N∑y=1MYx,y(5)Cbmean=1N∗M∑x=1N∑y=1MCbx,y(6)Crmean=1N∗M∑x=1N∑y=1MCrx,ywhere Ymean,Cbmean, and Crmean are the mean values for theYCbCr channels;Y (x, y), Cb (x, y),andCr (x, y)areYCbCr channel values for pixel at specific location(x, y);andN∗M is the total number of pixels.Figure 3
(a) An RGB image and its (Y), (Cb), and (Cr) channels.


## 2.3. Fire Color Pixel Detection Rules

In any fire image pixels, the red color value is larger than green and green is larger than blue as illustrated in Figure4: (a) is a fire image and (b) is the RGB channels histogram for the same image. This fact is represented in RGB color space as R>G>B and can be converted to YCbCr using the flowing equations:(7)Yx,y>Cbx,y(8)Crx,y>Cbx,yAlso, the Y component value is greater than the mean Y component of the same image and the Cb component is smaller than the mean Cb of same image, while the Cr component is greater than the mean Cr mean component. This fact can be represented by the flow:(9)Fx,y=1ifYx,y>Ym;Cbx,y<Cbm;Crx,y>Crm0OtherwisewhereF(x, y) can be any pixel on the image. Ym, Cbm, and Crm are the mean values for Y, Cb, and Cr, respectively.Figure 4
(a) RGB fire image and (b) the Histogram of the same image channels.
(a) (b)The Cb component as shown is predominantly “black” and the Cr component is “white”. This idea can be represented by the following equations:(10)Fx,y=1ifCbx,y-Crx,y≥τ0Otherwise(11)Fx,y=1;Cbx,y≤120⋂Crx,y≥1500Otherwisewhere τ is a constant, specified in [10] using receiver operating characteristic (ROC), by applying different values of τ in the range [1,100]. To measure the “true detection rate” and “false detection,” data sets consisting of 500 images (300 of them being images of a forest fire, 200 nonfire images) collected from Internet were used. Only (10) was used with different values of τ in the range [1,100] to detect binary images of the candidate fire region. τ was selected as τ = 70 resulting in a true detection rate of more than 90% and false detection of less than 40%.Figure5 shows the application of detection rules (7) through (11).Figure 5
Applying the rules (7)-(11) to input images: (a) original RGB images, (b) binary images using rule (7), (c) binary images using rule (8), (d) binary images using rule (9), (e) binary images using rule (10), (f) binary images using rules (7) through (11).
(a) (b) (c) (d) (e) (f)


## 2.4. Temporal Variation

Using color models alone is not enough to identify fire correctly because there are several objects that share the same fire color such as red leaves, desert, and other red moving objects. The main difference between actual fire and the fire-color objects is the nature of their motion. Shape and size of the flame are totally changeable, because of burning materials and airflow; thus, it produces higher temporal variation. In contrast, rigid bodies’ motion produces lower temporal variation. Therefore, it is possible to differentiate between the fire pixels and the fire color. To detect a fire movement, the difference between successive frames was analyzed. Suppose a video sequence consisting of n frames, and the average temporal variation is defined as [11] (12)Δx,y=1n∑i=1n-1fix,y-fi+1x,ywhere Δ(x, y) is the average temporal variation, fi(x,y) is a pixel intensity at the location(x, y) in theith frame. If Δ(x, y) >thr(experimentally determined threshold), then a moving pixel is fire.


## 3. Results and Performance Analysis

To measure the performance of the proposed model, 6 videos were collected from Internet, 3 of them are available at (http://www.ultimatechase.com/). Four of these videos were actual fire, and two were fire-color objects. The algorithm was implemented using MATLAB (R2017a) and tested on an Intel core i7 2.97 GHz PC 8GB-RAM PC. Figure 6 shows the variety of forest fire condition videos used in the test. A true-positive was counted if an image frame had fire pixels, and it was determined by the proposed model to be fire. In contrast, false-positive was counted, if the image frame has no fire, and the result was determined as a fire. Table 1 shows the true-positive, false-positive, percentage of true-positive, and percentage of false-positive for tested videos.Table 1
Result of the proposed algorithm.
Videos (# of frames)  Video_1 (260) Video_2 (246) Video_3 (208) Video_4 (251) Video_5(440) Video_6(585)  TP PTP TP PTP TP PTP FP PFP TP PTP FP PFP  235 90.38 236 95.93 201 96.63 21 8.36 403 91.59 54 9.23Figure 6
Tested forest fire videos.The results in Table1 show that the proposed method has achieved average true-positive percentage (TTP) up to 96.63% in the tested forest fire videos and 9.23% false-positive rate. These results indicate the good performance of the proposed method in forest fire detection.


### 3.1. Performance Evaluation

To evaluate the proposed method, comparison between some of the above-mentioned methods and the proposed one was carried out. All of these methods were tested in data sets consisting of 500 images (300 images of forest fire and 200 nonfire images) collected from Internet. Algorithms’ performances were calculated using the evaluation metric F-score.


#### 3.1.1. F-Score

The F-score [12] is used in this study to evaluate the performance of the fire detection algorithms. For any detection method, there are four potential results. If an image has fire pixels, and it was determined by the method as fire, then it is true-positive. If the same image is determined to be not a fire pixel by the algorithm, it is false-negative. If an image has no fire, and it was detected by the method as no fire, it is a true-negative, but if it was detected as fire by the method, it counts as a false-positive. Fire detection algorithms are evaluated using the following equations:(13)F=2∗precision.reallprecision+recall(14)precision=TPTP+FP(15)recall=TPTP+FNwhere F is F-score. TP, TN, FP, and FN are true-positive, true-negative, false-positive, and false-negative, respectively. A higher method F-score means a better overall performance. Table 2 and Figure 7 show the comparison results.(i)
TP-rate: obtained TP divided by the total number of fire images.(ii)
TN-rate: obtained TN divided by the total number of nonfire images.(iii)
FN-rate: obtained FN divided by the total number of fire images.(iv)
FP-rate: obtained FP divided by the total number of nonfire images.Table 2
Comparison rustles.
method TP-rate( % ) FN-rate( % ) TN-rate( % ) FP-rate( % ) recall % precision % F-score( % ) Thou-Ho et al.[6] 91.33 12 90 13.5 88.4 87.1 87.75 Yinglian et al.[7] 88.67 14.33 86.5 11 86.1 89 87.53 proposed 95 7 93.4 7.6 93.13 92.59 92.86Figure 7
Performance evaluation of three methods.Figure6 shows the F-score of the three methods. The proposed method F-score is higher than the existing methods described in [6, 7]; this indicates that the proposed method performs better than the existing methods.


## 3.1. Performance Evaluation

To evaluate the proposed method, comparison between some of the above-mentioned methods and the proposed one was carried out. All of these methods were tested in data sets consisting of 500 images (300 images of forest fire and 200 nonfire images) collected from Internet. Algorithms’ performances were calculated using the evaluation metric F-score.


### 3.1.1. F-Score

The F-score [12] is used in this study to evaluate the performance of the fire detection algorithms. For any detection method, there are four potential results. If an image has fire pixels, and it was determined by the method as fire, then it is true-positive. If the same image is determined to be not a fire pixel by the algorithm, it is false-negative. If an image has no fire, and it was detected by the method as no fire, it is a true-negative, but if it was detected as fire by the method, it counts as a false-positive. Fire detection algorithms are evaluated using the following equations:(13)F=2∗precision.reallprecision+recall(14)precision=TPTP+FP(15)recall=TPTP+FNwhere F is F-score. TP, TN, FP, and FN are true-positive, true-negative, false-positive, and false-negative, respectively. A higher method F-score means a better overall performance. Table 2 and Figure 7 show the comparison results.(i)
TP-rate: obtained TP divided by the total number of fire images.(ii)
TN-rate: obtained TN divided by the total number of nonfire images.(iii)
FN-rate: obtained FN divided by the total number of fire images.(iv)
FP-rate: obtained FP divided by the total number of nonfire images.Table 2
Comparison rustles.
method TP-rate( % ) FN-rate( % ) TN-rate( % ) FP-rate( % ) recall % precision % F-score( % ) Thou-Ho et al.[6] 91.33 12 90 13.5 88.4 87.1 87.75 Yinglian et al.[7] 88.67 14.33 86.5 11 86.1 89 87.53 proposed 95 7 93.4 7.6 93.13 92.59 92.86Figure 7
Performance evaluation of three methods.Figure6 shows the F-score of the three methods. The proposed method F-score is higher than the existing methods described in [6, 7]; this indicates that the proposed method performs better than the existing methods.


## 3.1.1. F-Score

The F-score [12] is used in this study to evaluate the performance of the fire detection algorithms. For any detection method, there are four potential results. If an image has fire pixels, and it was determined by the method as fire, then it is true-positive. If the same image is determined to be not a fire pixel by the algorithm, it is false-negative. If an image has no fire, and it was detected by the method as no fire, it is a true-negative, but if it was detected as fire by the method, it counts as a false-positive. Fire detection algorithms are evaluated using the following equations:(13)F=2∗precision.reallprecision+recall(14)precision=TPTP+FP(15)recall=TPTP+FNwhere F is F-score. TP, TN, FP, and FN are true-positive, true-negative, false-positive, and false-negative, respectively. A higher method F-score means a better overall performance. Table 2 and Figure 7 show the comparison results.(i)
TP-rate: obtained TP divided by the total number of fire images.(ii)
TN-rate: obtained TN divided by the total number of nonfire images.(iii)
FN-rate: obtained FN divided by the total number of fire images.(iv)
FP-rate: obtained FP divided by the total number of nonfire images.Table 2
Comparison rustles.
method TP-rate( % ) FN-rate( % ) TN-rate( % ) FP-rate( % ) recall % precision % F-score( % ) Thou-Ho et al.[6] 91.33 12 90 13.5 88.4 87.1 87.75 Yinglian et al.[7] 88.67 14.33 86.5 11 86.1 89 87.53 proposed 95 7 93.4 7.6 93.13 92.59 92.86Figure 7
Performance evaluation of three methods.Figure6 shows the F-score of the three methods. The proposed method F-score is higher than the existing methods described in [6, 7]; this indicates that the proposed method performs better than the existing methods.


## 4. Conclusions

This study proposes an effective forest fire detection method using image processing techniques including movement containing region detection based on background subtraction and color segmentation. The algorithm uses YCbCr color space which is better in separating the luminance from the chrominance and has good detection rate. five fire detection rules are applied to detect the fire. The performance of the proposed algorithm is tested on data set consisting of 6 videos collected from Internet, four of which were actual fire videos, while two were fire-like objects videos. TP-rate and TN-rate were calculated. The results show that the proposed algorithm achieves good detection rates. These results indicate that the proposed method is accurate and can be used in automatic forest fire-alarm systems.For future work, the system could be improved by using a combination of rules of different color spaces; however, the challenge is selecting the right rules from different color spaces to build the method.



---

*Source: 7612487-2018-10-21.xml*