Intelligent Identification and Emissions Estimation of Harmful Gas
Based on Background Segregation Algorithm
Li Leyang
1
Guo Shuaichen
2
and Hao Peifeng
1
1
Software College of Northeastern Uinversity, ChuangXin Street 195, Shenyang, China
2
Shenyang No.2 High School , Wuai Street 6 , China
Keywords: Environmental protection, Smog particle recognizing, Background segregation, Emission.
Abstract: Environmental protection has become an important issue in modern enterprises, usually involving harmful
liquid and harmful gas to be detected. In order to address this issue, we propose a new intelligent algorithm to
identify and estimate the emission based on the color and smoke. To be specific, the three-frame difference
method is used to achieve the background segregation, and the area of the smoke is separated after the images
are proceeded by a mask. The color dictionary is employed to determine what color it is. Then, the background
separation algorithm and the physics knowledge are used to establish an estimation model. In the experiment,
we use the proposed approach to estimate harmful gas emissions in the real-world production process of
enterprises. Results validate the effectiveness and efficiency of the proposed algorithm, in terms of the
prediction accuracy.
1 INTRODUCTION
Security is an important issue in the production process
of modern enterprises. It is a basic way to alarm in time
in a dangerous situation, because there are a large
number of necessary chemical reactions, which will
produce much smoke in the producing process.
According to the color of smoke, it can be judged
whether it is a toxic gas. According to the area and
volume of the smoke, it can be estimated how much
gas has been generated. Accordingly, we can activate
an alarm by combining these two conditions. First, we
can use background separation algorithm to separate
the smoke into a set of pictures with different features,
and calculate the area of smoke . Then, the color can
be obtained by a mask. Finally, we use an estimation
model to calculate the volume of gas. The video after
the background separation can be used to display in a
page, and then the user can see the shape and position
of the smoke. The combination of these two methods
can detect harmful gases to ensure a safety.
Therefore, this paper proposes an intelligent smoke
detection algorithm and design a smoke detection
system based on it. Especially, the proposed algorithm
is able to detect the color and area of smoke, and judge
whether it requires an alarm. In fact, we use the video
as experimental data and extract a set of pictures from
the video frame by frame. In order to obtain the
background separation, we use the frame difference
method, which has exhibited a powerful real-time
performance. After background separation, the area
algorithm is used based on the video data to find out
the proportion of white, which is the percentage of
smoke in the image. Based on the above, this paper
combines the knowledge of both physics and
mathematics to establish a set of mathematical models,
which are to calculate the volume. In the process of
production, the camera is fixed and the area being
photographed is also fixed. As long as the total
percentage of smoke is required, the area can be
accurately calculated. When detecting the color, this
system uses a color image separated by the background
separation masked. Generally, the proposed algorithm
judges the main color via a customized color dictionary,
because different production processes produce
different colors. Especially, the color dictionary can
add various colors according to different production.
Finally, this paper is implemented in Python, supported
by OpenCV, and Python+OpenCV reduces code
complexity.
Leyang, L., Shuaichen, G. and Peifeng, H.
Intelligent Identification and Emissions Estimation of Harmful Gas Based on Background Segregation Algorithm.
DOI: 10.5220/0008095800050009
In Proceedings of the International Conference on Advances in Computer Technology, Information Science and Communications (CTISC 2019), pages 5-9
ISBN: 978-989-758-357-5
Copyright
c
2019 by SCITEPRESS – Science and Technology Publications, Lda. All rights reserved
5
2 BACKGROUND SEPARATION
BASED ON FRAME
DIFFERENCE METHOD
Background separation is the key process to realize the
system function, which it is used for the display in a
page, thereby it is necessary and irreplaceable. There
are two methods to obtain the background separation
of video. The first one is based on the Mixture Gauss
Principle. Especially, the background segmentation
can be realized by using three background dividers
including KNN, MOG2, GMG, which are provided by
the Background Subtractor class in OpenCV. This
method can obtain a high detection rate by using a
concise process. However, it also has some
shortcomings. For example, it would consume too
much system resources due to its inherent principle of
the implementation. When a static object moves
suddenly, some redundant objects can be partitioned
out. Therefore, this method makes the actual system
perform poorly in some real-time application scenarios.
The second one is based on the frame difference
method. In this approach, the frame difference method
can effectively solve the problem of low real-time
performance. However, due to the fact that the
boundary of smoke surface is usually not clear, the
separated image may encounter the dilemma of
burning into ghosting. In order to address the above
problem, we use three frame difference method for
background segmentation in this paper.
Assume that the current frame is S(t), the previous
frame is S (t-1), and the next frame is S(t+1) Then, the
image I
1
is obtained by S(t) and S(t-1) after using this
algorithm, and the image I
2
is obtained by S(t+1) and
S(t). We can obtain that I = I
1
I
2
is the final image.
After that, the picture is processed by the morphology,
which can eliminate ghosting. In order to reduce the
image noise and to highlight the edge features, we refer
to the idea of multi-objective optimization and global
optimization. The purpose of these methods is to find
an appropriate way to obtain a satisfactory detection
accuracy.
3 CALCULATION OF SMOKE
AREA BASED ON
BINARIZATION METHOD
The existing methods usually use the image contour to
calculate the area of smoke, which needs
morphological processing. These methods detect the
image contour by using the edge detection function,
and calculate the area of each contour by using self-
defined area function, and then accumulate it.
Because the camera captures only one angle of smoke,
the smoke area refers to the cross-sectional area seen
from the camera angle. The camera is installed above
the position of smoke. In this paper, the area is
calculated by a binarization method, and the final
image is obtained by morphological processing. The
morphological processing is orient to a binary image
and it uses median filter to clear the noises. Then, the
picture is traversed and the number of white pixels is
recorded. Note that, the length h and width w of the
picture are calculated by the called shape method. The
total number of white pixels is recorded as whitenum .
The proportion of white pixels in whole image can also
be called the proportion of smoke, represented as
Eq.(1). Because the camera is fixed, the area of smoke
can regard as whitenum, multiplying area
photographed.
𝑎𝑟𝑒𝑎 = 𝑤𝑖𝑡𝑒𝑛𝑢𝑚/( 𝑤) (1)
Compared with other algorithms, this method has
less codes and a more simple logic. This means the
code complexity is simplified by this method in
background separation.
4 SMOKE VOLUME ESTIMATION
MODEL
The smoke is discharged from a small outlet and it
gradually spreads outward and upward. In order to
estimate the volume of smoke, the shape of smoke can
be roughly regarded as a cylinder. The camera is
installed on the top position of the smoke, so the
bottom area height varies with time. When installing
monocular camera condition, the height of smoke
can’t be measured by image recognition, which
requires a mathematical model to estimate the
relationship between smoke emission and bottom area.
The height of smoke increases gradually at the
beginning of process, then stabilizes, and finally
gradually decreases. The changing process is shown in
Figure 1. Because of the Fourier's Law, the gas
emission can be estimated through the rule of the
concentration change. The concentration C x y z t( , , , )
can be expressed as Eq.(2). The trend of gas emission
with time is shown in Eq.(3) . Among them, Q is the
CTISC 2019 - International Conference on Advances in Computer Technology, Information Science and Communications
6
gas emission, which is a larger number, can equal 10
3
and k is a proportional coefficient.
Figure 1: Emissions change with time.
kt
zyx
e
kt
Q
tzyxC
4
3
2
222
)4(
),,,(
(2)
kt
Q
ktr
ln4
(3)
Therefore, the relationship between smoke area
and time can be expressed as (4).
kt
Q
ktarea
ln4
(4)
The function of gas emission and smoke area can
be expressed as (5).
kt
area
e
kt
Q
4
(5)
In conclusion, the smoke volume can be estimated
according to the smoke area.
5 EXPERIMENT ON COMPILING
COLOR DICTIONARY
In the experiment, we usually use the masking to cut
the area of interest in a given image. Masking in the
image processing looks like the process of PCB plate
making, which uses a specific picture to shade the
image. The used mask is a two-dimensional matrix
array. We can get final image by using various
operations. The masking process is as follows.
Figure 2: Mask operation process.
&” is a common and simple operation, which can
use masks and original images to get the target area.
When judging the color of smoke, it is not necessary
to cut the smoke completely, only the part which
contains a large amount of smoke. The position of
smoke discharged from the production workshop is
fixed. Through the experiment, we selected the region
of 100 pixels around area where the smoke is
discharged, and use it as the mask, we set mask to 1,
the rest of the position is 0.
Some color detection methods by extract smoke
area, and normalize it to RGB space. Then, analyzing
the data of each color component. The way in this
paper of judge color through a customized color
dictionary. First, we define the upper bound and lower
bound of the color. The color dictionary is constructed
in RGB mode. The RGB value of the upper bound and
lower bound of color can be found in the drawing
software. Then, add the upper bound and lower bound
of a color to a list. Finally, take black as an example,
the following code defines a color.
lower_black = np.array([0, 0, 0])
upper_black = np.array([180, 255, 46])
color_list = []
color_list.append(lower_black)
color_list.append(upper_black)
dict['black'] = color_list
Traverse one picture, record the value of each color
pixel in the color dictionary, and compare the number
of each color pixel. The color of largest value is the
color of this picture.
6 EXPERIMENT RESULTS
In chapter two, we analysis some advantages in our
algorithm that others do not have. We found a video
on the Internet, and the comparison of experimental
results is as follows.
Figure 3: Original image. Figure 4: MOG2
Intelligent Identification and Emissions Estimation of Harmful Gas Based on Background Segregation Algorithm
7
Figure 5: GMG. Figure 6: Frame difference method.
It can be found that MOG2 method has a very poor
effect and can hardly separate the smoke. GMG
method can separate smoke contour roughly, but still
cant separate all the smoke. In contrast, using three
frame difference method to extract the foreground can
separate all the smoke, even slight smoke can be
extracted, which ensures accuracy for later calculation
of smoke area.
According to the experimental results in in terms of
the separated pictures and the resultant data, the
accuracy of color recognition can reach more than 99%.
The deviation between gas emission and actual gas is
shown in the following figure. It can be seen that most
of the estimated values are bigger than the actual
values, because the prediction model is calculated with
the maximum bottom area, so the value is bigger than
actual data, but such errors do not affect the volume
estimation.
Figure 7: Comparison between gas emission estimation and
actual gas production.
From the above, we can get the following observations:
(1) The frame difference method can generate a
better effect on these image set.
(2) The proposed mathematical model can
realize the estimation of smoke emission under the
condition of monocular camera, and it has a merit of
saving the cost.
7 CONCLUSIONS
In the processing of production, the traditional smoke
alarm system only detects whether there is smoke, but
can’t judge the toxicity and emissions of smoke, which
is ineffective to improve the accuracy of alarm. In this
paper, we propose an intelligent algorithm to
identify and estimate the emission based on the
color and smoke. In the experiment, the proposed
algorithm is used to estimate harmful gas emissions
in the real-world production process of enterprises.
The experimental results show that our algorithm can
identify the smoke more accurately, and judge the
color and emission more effectively This means our
algorithm obtain a desired performance, and it also
provides a new idea to identify the same type of defects.
ACKNOWLEDGEMENTS
This paper supported by National Natural Science
Foundation of China (6177021519,61503373), the
Fundamental Research Funds for the Central
Universities (N161705001.
REFERENCES
Nana Wang 2012.Research on video based fire smoke
detection algorithm.Xi'an University of Science and
Technology.Xian.
Peng Chen 2013.Image background separation based on
Gauss fuzzy logic.Computer and modernization.
Jianbo Li 2014.Research on moving object detection
algorithm in video surveillance.Harbin Institute of
Technology.Harbin.
L. Ma, X. Wang, M.Huang, Z.Lin, L..Tian, H.Chen 2017.
Two-level Master-slave RFID Networks Planning via
Hybrid Multi-objective Artificial Bee Colony Optimizer,
IEEE Transactions on Systems, Man, and Cybernetics:
Systems, PP(99):1-20.
L. Ma, X. Wang, M. Huang, H. Zhang, H. Chen 2017.A
Novel Evolutionary Root System Growth Algorithm for
Solving Multi-objective Optimization Problems, Applied
Soft Computing. 57:379-398.
L. Ma, K. Hu, Y. Zhu, H. Chen 2014.Cooperative Artificial
Bee Colony Algorithm for Multi-objective RFID
Network Planning. Journal of network and computer
applications. 143-162.
L. Ma, H.Chen, X.Li, X.He,X.Liang 2016.Root system
growth biomimicry for global optimization models and
emergent behaviors, Soft computing.21(24):1-18.
H.Chen, L. Ma*, M. He, X. Wang* 2016.Artificial Bee
Colony Optimizer Based on Bee Life-cycle for
CTISC 2019 - International Conference on Advances in Computer Technology, Information Science and Communications
8
Stationary and Dynamic Optimization. IEEE
Transactions on Systems. Man, and Cybernetics:
Systems, 1-20.
L.Ma, X.Wang, R.Yu 2018.Biomimicry of plant root growth
using bioinspired foraging model for data clustering.
Neural Computing & Applications,29(3):1-18.
Lin Deng 2015.Research on video smoke detection
algorithm.University of Electronic Science and
technology of China.Chengdu.
Yongcai Hu 2017.Smoke detection algorithm based on low
illumination indoor video images.Xi'an University of
Science and Technology.Xian.
Zijian Liu 2014.Fire smoke diffusion model based on Gauss
distribution.Fire science and technology.
Lu Zheng,Junzhou Chen 2010.Video smoke detection
algorithm based on motion and color.Computer
engineering and design.
Yuehua Li, Lei Shan 2016.Fire smoke color detection
algorithm based on video sequence.Semiconductor
photoelectricity.
L. Ma, S.Cheng, X. Wang, M.Huang, H. Shen, X. He, Y. Shi
2017.Cooperative Two-engine Multi-objective Bee
Foraging Algorithm with Reinforcement Learning,
Knowledge-Based Systems,133:278-293.
L. Ma, Y. Zhu,Y. Liu, L. Tian 2015.A novel bionic algorithm
inspired by plant root foraging behaviors, Applied Soft
Computing, 37:95-133.
L. Ma, K. Hu, Y. Zhu, H. Chen 2015.A Hybrid Artificial Bee
Colony Optimizer by combining with life-cycle,
Powell’s search and crossover, Applied Mathematics and
Computation,vol.252, pp.133–154.
L. Ma, Y. Zhu, K. Hu 2014.A Novel Plant Root Foraging
Algorithm for Image Segmentation Problems,
Mathematical Problems in Engineering, Article ID
471209, 16 pages.
L. Ma, Li X, Gao T, et al 2016.Indicator-Based Multi-
objective Bacterial Foraging Algorithm with Adaptive
Searching Mechanism.Bio-Inspired Computing -
Theories and Applications. Springer Singapore, 271-277.
Wang R, Chen S, Ma L, et al 2018.Multi-indicator Bacterial
Foraging Algorithm with Kriging Model for Many-
Objective Optimization. Advances in Swarm Intelligence.
L. Ma, K. Hu, Y. Zhu, H. Chen 2014.Improved Multi-
objective Artificial Bee Colony Algorithm for optimal
power flow problem, Journal of Central South
University, 21(11): 4220-4227.
Chen S, Wang R, Ma L, et al 2018.A Novel Many-Objective
Bacterial Foraging Optimizer Based on Multi-engine
Cooperation Frameworz. International Conference on
Swarm Intelligence. Springer, Cham, 520-529.
Intelligent Identification and Emissions Estimation of Harmful Gas Based on Background Segregation Algorithm
9