# Application Research of Image Processing Technology for Fire Detection and Fire Alarm Based on Blockchain

Authors: Fan Zhao
Journal: Mobile Information Systems
 (2022)

---

## Abstract

Aiming at the problems of leakage alarms and false alarms in fire detection systems, this paper explores the commonality and characteristics of its development process through in-depth analysis of typical fire detection and fire alarm modes at home and abroad and effectively summarizes the process of building fire alarms. In the case of fully grasping the principles of fire alarm and related policy protection, find out the appropriate development mode of fire alarm. At the same time, it can also study the perspectives of the government, the market, and the public, according to the needs of the market, it can be driven by industry and technological innovation can be used as a strong support for the development of fire alarm. Finally, the results of example analysis show that: using blockchain, this paper can effectively obtain high-precision fire detection and fire alarm target analysis results, and meet the needs of real-time analysis of fire detection and fire alarm analysis. Experiments show that the system can detect fires correctly and quickly, and identify interference sources such as fluorescent lamps and alcohol lamps. It has strong interference and good economic benefits.


---

## Body

## 1. Introduction

Fire detection technology is mainly based on the processing of signals by different types of sensors to complete fire detection and early warning. With the continuous increase of fire detection and fire alarm in China, the large-scale fire detection and fire alarm in China have developed rapidly, and more fire alarm methods have emerged [1, 2]. Detailed analysis of fire alarm methods is carried out, in order to explore the problems and shortcomings in the fire detection and fire alarm process, so as to formulate training and improvement plans later. In the process of traditional fire alarm methods [3, 4], two-dimensional maps are usually mainly used for fire detection and fire alarm analysis of fire alarm methods. However, because two-dimensional maps can only describe the relative height of the environmental plane information, they cannot provide relatively complete data information [5, 6]. The requirements of the fire alarm mode now require that the fire alarm mode enterprise can solve the one-stop service system, provide strong support for life, and allow the entire fire alarm mode to obtain the highest economic benefits, which is the overall goal of the fire alarm mode enterprise. Fire detection and fire alarm analysis play an important role in fire alarm methods. A good fire detection and fire alarm analysis system can speed up the flow of fire alarm methods, reduce costs, ensure the normal operation of services, and at the same time achieve effective management of resources and use.In order to effectively improve the accuracy of fire detection and fire alarm analysis in the process of fire alarm mode, this paper proposes a fire alarm mode method under the blockchain and uses the blockchain to analyze the real-time evolution of targets in fire detection and fire alarm. Finally, through the analysis of the experimental results, it is shown that by comparing other specific practices of fire detection and fire alarm, this paper designs a fire alarm system with image information, which improves the speed and reliability of the system’s alarm output, and can correctly identify switch interference such as fluorescent lamps and candles to prevent interference.


## 2. Methods

### 2.1. Related Technologies of Fire Image Detection

The blockchain golden fox mainly connects multiple units according to the appropriate method, and the most basic unit is called the meta-network, which is mainly composed of elements, connection methods, and activation functions. The protrusion of the nerve is connected; the activation function is mainly a linear mapping and a nonlinear mapping in the system, and at the same time, the output of the neuron can be limited within a specific range. Among them, the basic model of the blockchain is shown in Figure1.Figure 1
Schematic diagram of the basic model.The blockchain model can be represented by the following formula:(1)μj=∑i=1nWijxi−θj,yj=fμj.In the above expression:μj represents the real situation inside the blockchain; θj represents the deviation (threshold) of the blockchain; X¯=x1,x2,…,xnT represents the input signal, xi represents the i-th input node value; and yj represents the j-th blockchain The output value of W=Wj1,Wj2,…,Wjn represents the weight from the input node in the blockchain; and f represents the activation function.


#### 2.1.1. Step 1: Construct the User-Blockchain Evaluation Matrix

The blockchain is represented by a matrixAm×n, where m represents the specific number of users, n represents the number of blockchains, and the element Ri,j in column j of the i-th row represents the evaluation score of user i on blockchain j. If it satisfies 0<Ri,j≤5, it means that the evaluation is closer to 0, and correspondingly, it means that the user is not aware of the alarm method for this blockchain. If the evaluation value is closer to 5, it means that the user is very high on this blockchain, and 0 means that the user has not responded to this blockchain. Do an assessment. The user-blockchain corresponding evaluation matrix is shown in the following expression :(2)Am×n=R1,1R1,2⋯R1,nR2,1R2,2⋯R2,n⋮⋮⋮Rm,1Rm,2⋯Rm,n.


#### 2.1.2. Step 2: Construct the Similarity Matrix

First, the user’s blockchain needs are expressed as an appropriate user alarm mode model, the most general form of which is the user alarm mode vector. Then, the blockchain items to be processed are represented as vectors of the same dimension. Computation of the user’s blockchain requires the similarity between the vector and each blockchain object vector. In order to better represent the user’s alarm mode and reduce the computational complexity, the blockchain purpose feature model and user-sensing alarm mode model are represented by the space vector method. The space vector representation can not only contain the data information of the user’s alarm mode in detail, but also can construct a vector model with this keyword, and complete the weight value of each vector model according to the user’s alarm mode. Combined with the content-blockchain project, it can be divided into two types: text-based blockchain and nontext-based blockchain. Among them, for text-based blockchain projects, the TF-IDF algorithm can be used to calculate the weight value. For nontext blockchain projects, their weights can be calculated with the help of the error value between blockchain attributes and user attributes.For nondocument-type blockchains, the weight of blockchainj for attribute tm is calculated as shown in the following formula:(3)wjm=1,knowledge item i have attributes,0,knowledge item j no attribute.For projects with blockchain attributes, the user’s alarm method does not consider absolute positive or negative, and usually can also represent any value between [0, 1] according to his or her alarm method preference. The weight calculation formula of the feature itemtm is as follows:(4)wim=rtm/arui/b.Among them,wim is used to indicate the degree of user i’s liking for the attribute feature tm of the blockchain, that is, the so-called weight value. If the calculated value is closer to 1, it indicates that the secondary user has a higher interest in the attribute feature tm; rtm represents the sum of the evaluations of the attribute feature tm under the evaluation of user i; and rui represents the sum of all evaluation scores of user i. The sum a, b represent the number of items corresponding to the blockchain evaluation in turn.According to the space vector representation of the function, the alarm mode of useri can be represented by a vector, the feature vector of j in the blockchain can be represented by a vector, t represents the attribute feature in the blockchain Ui=t1,wi1,t2,wi2,…,tm,wim, and w represents the weight of the feature item in the model Vj=t1,wj1,t2,wj2,…,tm,wjm. Then the similarity expression can be obtained as(5)simUi,Vj=cosUi,Vj,=UiVjUiVj,=∑k=1mwikwjk∑k=1mwik2∑k=1mwik2.Process the similarity so that the similarity is numerically consistent with the score:(6)sim′Ui,Vj=5×simUi,Vj.From the calculated similarity, the structural similarity matrixBm×n is shown in the following formula:(7)Bm×n=sim′U1,V1sim′U1,V2⋯sim′U1,Vnsim′U2,V1sim′U2,V2⋯sim′U2,Vn⋮⋮⋮sim′Um,V1sim′Um,V2⋯sim′Um,Vn.


#### 2.1.3. Step 3: Construct a New User-Blockchain Evaluation Matrix

According to the evaluation matrix and similarity matrix obtained above, the 0 values that have not been evaluated in the evaluation matrix of the original user-blockchain can be replaced, and can be converted into the values in the corresponding similarity matrix [7, 8], and then the-region block chain evaluation matrix, assuming that the value evaluated by the new matrix is represented by Ri,j′(8)Ri,j′=Ri,j,Ri,j≠0,sim′Ui,Vj,Ri,j=0,,i=1,2,…,m,j=1,2,…,n.Therefore, the new user-blockchain evaluation matrixCm×n is expressed as(9)Cm×n=R1,1′R1,2′⋯R1,n′R2,1′R2,2′⋯R2,n′⋮⋮⋮Rm,1′Rm,2′⋯Rm,n′.


#### 2.1.4. Step 4: Retrieve Neighboring Neighbor Evaluation Items

Searching for optimal neighbors is the core content of the algorithm cited in this paper, and the efficiency and effect of this process also affect the efficiency and effect of the push algorithm to a certain extent. Similar to the optimal neighbor mainly refers to the user group that is relatively close to the user group under the current evaluation operation. The similar optimal neighbor is actually a process of building a model in the blockchain, that is, using the evaluation matrixCm×n of the blockchain, The similarity between the user i and the user j is calculated by the similarity algorithm, which can be represented by sim(i, j). The set of blockchains evaluated by user i and user j is represented by Iij, then the corresponding sim(i, j) can be calculated by using the Pearson correlation coefficient. The calculation formula is expressed as follows:(10)simi,j=∑c∈IijRi,c′−Ri′¯Rj,c′−Rj′¯∑c∈IijRi,c′−Ri′¯2∑c∈IijRj,c′−Rj′¯2,Here, the evaluation value of user i to blockchain c in the blockchain evaluation matrix is represented, and the evaluation value of user j to blockchain c in the blockchain evaluation matrix is represented. Ri,c′,Rj,c′,R′¯i, and R′¯j represent the average evaluation values of user i and user j in turn.


#### 2.1.5. Step 5: Push the User’s Content Similarity

The degree of similarity that can be calculated can accurately find the similar optimal neighbors of the target user and complete the push to its blockchain. Assuming that the nearest neighbor set of useru is represented by NNu, then the evaluation value of user u to blockchain i, using Pu,i, can borrow the evaluation of the blockchain in the nearest neighbor set NNu of user u, and the calculation process is as follows:(11)Pu,i=Ru′¯+∑n∈NNusimu,n×Rn,i′−Rn′¯∑n∈NNusimu,n.Among them, sim(u, n) represents the similarity between useru and user n, Rn,i′ represents the evaluation of user n on blockchain i, Ru′¯ and Rn′¯ represent the average value of user u and user n on the blockchain in turn.There are two main stages to running the blockchain.(1)
Training phase: In this phase, the input data and output data of the sample are input or output to the blockchain, the weights and thresholds of node connections are learned and modified, and the parameters are optimized by numerical calculation methods until the generated output matches the required value. Required value.(2)
Prediction stage: This stage is mainly used to predict unknown samples. The blockchain is based on gradient descent learning, and the algorithm can modify the weight value in the opposite direction of the error performance function gradient. Figure2 shows a block chain-based image detection block diagram.Figure 2
Block diagram of image detection based on BP neural algorithm.The training samples of this paper include 9 mineral lamp images, 9 incandescent light bulb images, 9 lamp images, and 50 fire images in total. Select 25 samples of the trained neural network as the input of the neural network, in which 10 flame images, 5 incandescent light bulb images, 5 miner’s lamp images, and 5 car lamp images are collected, and the collection speed is 25 f/s.


### 2.2. Fire Detection and Fire Alarm Model

In this paper, the fire alarm system design based on SEED-VIM642 mainly adopts DSP technology. On the basis of sufficient traditional alarm methods, the digital image processing technology is effectively combined to design a fire alarm system. Data is mainly divided into information layer, feature layer, and decision layer (Figure3).Figure 3
Information processing flow of fire alarm system.If there is a fire, the gray value of the image corresponding to the fire scene will change due to the random movement of the fire smoke, and the pixel value of the corresponding fire image will also change differently, and then the gray value will change in a matrix, which changes. This will be accompanied by changes in the values of parameters such as energy, partial changes, and inertia. If the image parameters of the fire scene are represented by x1, x2, x3, and x4 in sequence according to the row vector, the average fluctuation of the change trend of the fire scene image can be expressed as(12)yn=14∑i=1,4xin−xin−1.According to the average energy fluctuation, the change parameters of the fire texture can be judged. The parameter judgment of the fire feature layer is mainly based on the neural network data recognition method. The fire monitoring system constructed by this method can improve the fault tolerance of the system against changes in the environment [9, 10]. The corresponding the network structure is shown in Figure 4.Figure 4
Fire detection and fire alarm model.The network structure of the blockchain is mainly composed of a radial-based network layer and a conflicting network layer. For the pattern classification of small samples in the blockchain-based fire image detection, in general, we choose to use the blockchain based on the process of building small samples and nonlinear models, and choose to use functions and penalty factor. For a given model sampleS1:xi,yi,i=1,2,…,n, the blockchain can be used to transform the problem into:(13)min,Jw,b,e=wTw+12C2∑i=1nei2,s.t,yi=wTφxi+b+ei,i=1,2,…,n.The parameters that can be solved for the blockchain function are expressed as(14)k+C2⋅I1⟶1T⟶0⋅ab=y0.In the process of solving the above problems, the most common method is the conjugate gradient method. This method has the advantages of simple operation and large data storage, and has the advantages of fast convergence speed, and so on. It can better solve the above problems. The conjugate gradient method needs to obtain the search direction, and the step factor as the premise of the calculation. Based on the blockchain, this paper uses the conjugate gradient algorithm to realize the sum of the squares of the sample errors to construct the blockchain model. The process of fire image detection based on blockchain is shown in Figure5.Figure 5
Flowchart of fire image detection based on blockchain.


### 2.3. Flame Image Processing Process

Grayscale conversion: Since the values ofR, G, and B range from 0 to 255, the grayscale level is 256, that is, a grayscale image can only express 256 colors (grayscale). On the other hand, since a grayscale image is easy to handle and convert, the image of the processing object is first converted to a grayscale image. In order to convert into a grayscale image, the weighted average method is used, and the expression is as follows:(15)R=G=B=R×WR+G×WG+B×WB.In the formula,R is red light with a wavelength of 700 nm, G is green light with a wavelength of 546.1 nm, B is blue light with a wavelength of 435.8 nm, WR is the weighted value of red light, WG is the weighted value of green light, and WB is the weighted value of blue light value.According to the principle of three colors, the most reasonable grayscale image is obtained withWR = 0.30, WG = 0.59, and WB = 0.11. Using the weighted average method, as shown in Figure 6, the 24 bit true color image of the flame was converted to a grayscale image.Figure 6
Grayscale image of flame.


#### 2.3.1. Binarization of Images

The image binarization process is essentially a kind of image segmentation method. The effect of binarization enhances the contrast of the image. The binary image is the basis for the subsequent target recognition. Therefore, it is important to obtain a binary image with less interference pixels. The most important problem in the binarization process is obviously the problem of threshold selection.(1) Iterative threshold method. The threshold iteration scheme can automatically search for a relatively suitable threshold through the program. If the iterations are repeated in this way, there is no change in the switching function, i.e., if the iterations converge to a stable threshold, the current threshold is used as the final result of image segmentation. The iterative look at equation:(16)Ti+1=12∑k=0Tihk∘k∑k=0Tihk+∑k=Ti+1L−1hk∘k∑k=Ti+1L−1hk.Ti in the expression represents the threshold value of the image solution for the i-th iteration; L represents the number of gray levels; and hk represents the number of pixels with a gray value of k. The binarized image solved using the above method is shown in Figure 7.Figure 7
Binarized image by iterative threshold method.(2) Maximum inter-class variance method. The basic idea of the maximum interclass dispersion method is to use the grayscale histogram of the image to dynamically determine the segmentation threshold of the image with the aim of maximizing the dispersion of the target and the background. The operation process is as follows: take a gray value, use the gray value as the boundary, divide the image into two gray value sizes, and calculate the number of pixels and the gray average value of the two types, respectively. Next, these interclass dispersions are calculated, and finally the gray level corresponding to the maximum value of all gray level interclass dispersions is used as a threshold. The quoted formula (17) for calculating the variance between classes:(17)ωi=n1in2iv1i−v2i2.In the expression,n1i and n2i are the pixels whose grayscale is less than i, the number of pixels whose image is not less than i, v1i and v2i represent the corresponding average values of n1i and n2i in turn. ω(i) is expressed as a function of the gray value of the image as a parameter, and the function value of the solution image is set as the maximum value, that is, the binarization threshold of the image corresponding to the case where ω(i) and the maximum value are solved is shown in the following expression:(18)T=ArgMaxωi.Among them,T represents the segmentation threshold of the binarization of the image.Figure8 shows a binarized image obtained by the maximum interclass dispersion method.Figure 8
Binarized image with maximum between-class variance method.Comparing Figures7 and 8, it can be seen that the maximum interclass dispersion method can better achieve the separation of flame and background.In order to highlight the characteristics of the flame in the image, the small flames in the image need to be removed, and this can be achieved using erosion and dilation algorithms in mathematical formal processing. As shown in Figure9(b), Figure 9 shows a processing example of performing an etching operation on a target image using structural elements to obtain a calculation result (as shown in Figure 9(c)).Figure 9
Image erosion operation process.
(a)(b)(c)Figure10(a) is the original image, the constituent elements used here are crosses (as shown in Figure 10(b)), and Figure 10(c) is obtained after the expansion process. The pixels represented by black are new pixels that are generated by expansion that do not belong to the original target, and the pixels represented by gray are the position of the original image. As can be seen from Figure 10, dilation merges all background points in contact with the target to the target, the direct result of which is to expand the coverage area on the boundary by augmenting the original target image. Figures 11 and 12 show the results of the etching and dilation calculations of the flame binarized image.Figure 10
Image dilation operation process.
(a)(b)(c)Figure 11
Image erosion results.Figure 12
Image dilation result.The method described in this article can be operated through the following steps. For images with inconsistent formats from a wide range of sources, they need to be converted into grayscale images first; after binarization, they are converted into black and white bitmaps; finally, image morphological methods are used to remove noise. Remove furniture outside the building and objects of the text introduction class. Therefore, in different cases, most of the building interior plans are in the form of “horizontal, horizontal and vertical”, and the Hough method is used to convert two important directions. By rotating the obtained image around thex-axis and y-axis, the image block is obtained to improve the vectorization efficiency of the image.The software research of image manipulation function is the process of blockchain object identification and processing. When 3D products are operated in image recognition technology, first of all, it is necessary to obtain the feature values of the target through target expansion training, and establish an effective and useful feature map [3, 11]. During the operation of the system, the feature value of the current operand is obtained, which is consistent with the feature map to achieve the purpose of identifying the target object. Figure 13 shows the flow of the image processing module.Figure 13
The software design flow of the image processing module.As shown in Figure13, 3D modeling products require image preprocessing during image processing, which is also used to minimize image data and improve the detectability of useful information. Image segmentation is the technique and process of segmenting an image into several specific regions with unique properties and proposing objects of interest. Create a feature map consistent with image attribute values, extract the target object, and find the most effective attribute from multiple features. Image matching refers to the comparison between the extracted feature quantity and the feature mapping table to achieve the purpose of target object recognition.


#### 2.3.2. Region Blocking Based on Integral Projection

After the preprocessing is completed, in order to quickly segment each wall region, the average integral projection function is used to extract the image region containing the wall line. If there is a change in the pixel gray mean value of a column (row) of an image, the change will respond to the mean integral projection value of the column (row) [12, 13]. The mean integral projection function is shown in the following equation:(19)Mvx=1y2−y1∫y1y2Ix,ydy,Mhy=1x2−x1∫x1x2Ix,ydx.Here, I(x, y) ice point (x, y) pixel gray value; Mv(x)[y1, y2] presents the vertical mean integral projection function in the interval. Mh(y)[x1, x2] represents the horizontal mean integral projection function in the interval.(20)Mv′y=Mvx−minMvxmaxMvx−minMvx,Mh′x=Mhx−minMhxmaxMhx−minMhx.


#### 2.3.3. Block Image Vectorization

Through the integration head-type process, the whole image is divided into multiple word images, and each subimage includes multiple vertical or horizontal image units and some architectural data of the wall geometry are obtained through the line segment coupling of the postoperation bandwidth. Therefore, for the characteristics of these subimages, the advantages of the traditional SPV method and calculation level are maintained, in which the SPV is not in place in the recognition of the axes and small structures in the picture, and the discrimination ability of the intersection of lines is calculated. The adjustment is proposed and applied to separate images, which is helpful for the recognition and vectorization efficiency of graphics. The central points are detailed below.(1) Selection of axis point and tracking direction. In the vectorization method used above, by searching for the axis points, the scan lines are scanned from the upper and lower sides of the preset block binary image. If the first black pixel point to be scanned is P0, scan to the right from P0 until the first white pixel point P0 and 39, and obtain the horizontal running midpoint P1 at the same time. Then, start from P1 and scan twice in the opposite direction from the vertical direction, passing through the midpoint P2 in the vertical direction. Similarly, it is necessary to ensure that the distance from P2 to the midpoint P3 of horizontal operation is less than the previously set value. The value of PiPi−1 is generally 1 pixel. Therefore the Pi point is defined as the pivot point. Through the experiment, get the correct starting axis point and repeat 3∼5 steps normally.After passing the axis pointPi, the horizontal and vertical values Pi of the point are obtained. If the width in the horizontal direction and the width in the vertical direction are longer, the inclination of the line in the horizontal direction is less than 45°, and the length direction of the line segment is considered to be horizontal, otherwise the length direction is vertical. The width and length directions of the segments intersect. In this method, determining the length direction is the determining direction of the post-tracking procedure.(2) Determine the sparse point. Through the length of the action, the search is carried out. Assuming the length action is horizontal then the search direction is from right to left; assuming the length action is vertical, it should be from bottom to top. Figure 13 shows that it is found that not long is the previously determined value, through the current P4 (P’4), and then moves the red arrow direction to the tracking step and then moves it to the black pixel value. Continue and trace the vertical behavior in both directions through this value, while crossing the white pixel values P5l and P5rP5u and P5d. Calculate the series number P5 (P’5) of the white pixel value, which is a new central axis number, and the value of the record point line width is cut off tracking. If three conditions are met at the same time, a new query needs to be started from this point [14–16].(1)
The line width difference between the new central axis number and the previous central axis number is within the receiving range;(2)
The new central axis number has never been queried;(3)
The real search step is greater than the value 0.In image connections such as intersection regions, branches, rotation angles, the node segmentation procedure is usually executed in violation of these three conditions.(3) Node segmentation. If you violate one or more of the keep track conditions, the sparse point tracker will pause and node splitters, such as segment intersections and corners, will be enabled. Node segmentation is repeated in the following 3 steps [17, 18].(1)
Return to the previous central axis point;(2)
Adjust the tracking step to half of the current step.(3)
Detect the continue condition at the new location.When the detection fails, halve the step size and repeat. However, if the point at the new location satisfies all the conditions to resume the original tracking step from that point, the tracking is performed. The repeated tracking step size is 0, the node segmentation process ends, and all the conditions found at the end are satisfied to be the new central axis point. Through such processing, the program can divide the cross area into 3 straight line segments more accurately with the intersection as the boundary, and the corner polyline can be divided into two very accurately.(4) Line segment integration. Because of the factor of image quality and line segment intersection, the original line to be connected is vectorized and divided into multiple separated line segments. To deal with this situation, it is necessary to combine the next line segments to achieve the combination of line segments connected at the same time in a horizontal line with the same line width. Import the line segment to be solved, with the structure of start, end coordinate direction, and line width data [19]. By using the end coordinates to remove the start coordinates, the number of each line segment can be obtained, and the value of each two angles can be calculated by vector calculation. If the angles of the two vectors are similar to 0, it can be concluded that the central axes of the two line segments are almost parallel. Assuming that the two parallel close distances are smaller than the predetermined line width, the two straight lines are combined, and the intersection segment through the node segmentation procedure is integrated into a complete line.


## 2.1. Related Technologies of Fire Image Detection

The blockchain golden fox mainly connects multiple units according to the appropriate method, and the most basic unit is called the meta-network, which is mainly composed of elements, connection methods, and activation functions. The protrusion of the nerve is connected; the activation function is mainly a linear mapping and a nonlinear mapping in the system, and at the same time, the output of the neuron can be limited within a specific range. Among them, the basic model of the blockchain is shown in Figure1.Figure 1
Schematic diagram of the basic model.The blockchain model can be represented by the following formula:(1)μj=∑i=1nWijxi−θj,yj=fμj.In the above expression:μj represents the real situation inside the blockchain; θj represents the deviation (threshold) of the blockchain; X¯=x1,x2,…,xnT represents the input signal, xi represents the i-th input node value; and yj represents the j-th blockchain The output value of W=Wj1,Wj2,…,Wjn represents the weight from the input node in the blockchain; and f represents the activation function.


### 2.1.1. Step 1: Construct the User-Blockchain Evaluation Matrix

The blockchain is represented by a matrixAm×n, where m represents the specific number of users, n represents the number of blockchains, and the element Ri,j in column j of the i-th row represents the evaluation score of user i on blockchain j. If it satisfies 0<Ri,j≤5, it means that the evaluation is closer to 0, and correspondingly, it means that the user is not aware of the alarm method for this blockchain. If the evaluation value is closer to 5, it means that the user is very high on this blockchain, and 0 means that the user has not responded to this blockchain. Do an assessment. The user-blockchain corresponding evaluation matrix is shown in the following expression :(2)Am×n=R1,1R1,2⋯R1,nR2,1R2,2⋯R2,n⋮⋮⋮Rm,1Rm,2⋯Rm,n.


### 2.1.2. Step 2: Construct the Similarity Matrix

First, the user’s blockchain needs are expressed as an appropriate user alarm mode model, the most general form of which is the user alarm mode vector. Then, the blockchain items to be processed are represented as vectors of the same dimension. Computation of the user’s blockchain requires the similarity between the vector and each blockchain object vector. In order to better represent the user’s alarm mode and reduce the computational complexity, the blockchain purpose feature model and user-sensing alarm mode model are represented by the space vector method. The space vector representation can not only contain the data information of the user’s alarm mode in detail, but also can construct a vector model with this keyword, and complete the weight value of each vector model according to the user’s alarm mode. Combined with the content-blockchain project, it can be divided into two types: text-based blockchain and nontext-based blockchain. Among them, for text-based blockchain projects, the TF-IDF algorithm can be used to calculate the weight value. For nontext blockchain projects, their weights can be calculated with the help of the error value between blockchain attributes and user attributes.For nondocument-type blockchains, the weight of blockchainj for attribute tm is calculated as shown in the following formula:(3)wjm=1,knowledge item i have attributes,0,knowledge item j no attribute.For projects with blockchain attributes, the user’s alarm method does not consider absolute positive or negative, and usually can also represent any value between [0, 1] according to his or her alarm method preference. The weight calculation formula of the feature itemtm is as follows:(4)wim=rtm/arui/b.Among them,wim is used to indicate the degree of user i’s liking for the attribute feature tm of the blockchain, that is, the so-called weight value. If the calculated value is closer to 1, it indicates that the secondary user has a higher interest in the attribute feature tm; rtm represents the sum of the evaluations of the attribute feature tm under the evaluation of user i; and rui represents the sum of all evaluation scores of user i. The sum a, b represent the number of items corresponding to the blockchain evaluation in turn.According to the space vector representation of the function, the alarm mode of useri can be represented by a vector, the feature vector of j in the blockchain can be represented by a vector, t represents the attribute feature in the blockchain Ui=t1,wi1,t2,wi2,…,tm,wim, and w represents the weight of the feature item in the model Vj=t1,wj1,t2,wj2,…,tm,wjm. Then the similarity expression can be obtained as(5)simUi,Vj=cosUi,Vj,=UiVjUiVj,=∑k=1mwikwjk∑k=1mwik2∑k=1mwik2.Process the similarity so that the similarity is numerically consistent with the score:(6)sim′Ui,Vj=5×simUi,Vj.From the calculated similarity, the structural similarity matrixBm×n is shown in the following formula:(7)Bm×n=sim′U1,V1sim′U1,V2⋯sim′U1,Vnsim′U2,V1sim′U2,V2⋯sim′U2,Vn⋮⋮⋮sim′Um,V1sim′Um,V2⋯sim′Um,Vn.


### 2.1.3. Step 3: Construct a New User-Blockchain Evaluation Matrix

According to the evaluation matrix and similarity matrix obtained above, the 0 values that have not been evaluated in the evaluation matrix of the original user-blockchain can be replaced, and can be converted into the values in the corresponding similarity matrix [7, 8], and then the-region block chain evaluation matrix, assuming that the value evaluated by the new matrix is represented by Ri,j′(8)Ri,j′=Ri,j,Ri,j≠0,sim′Ui,Vj,Ri,j=0,,i=1,2,…,m,j=1,2,…,n.Therefore, the new user-blockchain evaluation matrixCm×n is expressed as(9)Cm×n=R1,1′R1,2′⋯R1,n′R2,1′R2,2′⋯R2,n′⋮⋮⋮Rm,1′Rm,2′⋯Rm,n′.


### 2.1.4. Step 4: Retrieve Neighboring Neighbor Evaluation Items

Searching for optimal neighbors is the core content of the algorithm cited in this paper, and the efficiency and effect of this process also affect the efficiency and effect of the push algorithm to a certain extent. Similar to the optimal neighbor mainly refers to the user group that is relatively close to the user group under the current evaluation operation. The similar optimal neighbor is actually a process of building a model in the blockchain, that is, using the evaluation matrixCm×n of the blockchain, The similarity between the user i and the user j is calculated by the similarity algorithm, which can be represented by sim(i, j). The set of blockchains evaluated by user i and user j is represented by Iij, then the corresponding sim(i, j) can be calculated by using the Pearson correlation coefficient. The calculation formula is expressed as follows:(10)simi,j=∑c∈IijRi,c′−Ri′¯Rj,c′−Rj′¯∑c∈IijRi,c′−Ri′¯2∑c∈IijRj,c′−Rj′¯2,Here, the evaluation value of user i to blockchain c in the blockchain evaluation matrix is represented, and the evaluation value of user j to blockchain c in the blockchain evaluation matrix is represented. Ri,c′,Rj,c′,R′¯i, and R′¯j represent the average evaluation values of user i and user j in turn.


### 2.1.5. Step 5: Push the User’s Content Similarity

The degree of similarity that can be calculated can accurately find the similar optimal neighbors of the target user and complete the push to its blockchain. Assuming that the nearest neighbor set of useru is represented by NNu, then the evaluation value of user u to blockchain i, using Pu,i, can borrow the evaluation of the blockchain in the nearest neighbor set NNu of user u, and the calculation process is as follows:(11)Pu,i=Ru′¯+∑n∈NNusimu,n×Rn,i′−Rn′¯∑n∈NNusimu,n.Among them, sim(u, n) represents the similarity between useru and user n, Rn,i′ represents the evaluation of user n on blockchain i, Ru′¯ and Rn′¯ represent the average value of user u and user n on the blockchain in turn.There are two main stages to running the blockchain.(1)
Training phase: In this phase, the input data and output data of the sample are input or output to the blockchain, the weights and thresholds of node connections are learned and modified, and the parameters are optimized by numerical calculation methods until the generated output matches the required value. Required value.(2)
Prediction stage: This stage is mainly used to predict unknown samples. The blockchain is based on gradient descent learning, and the algorithm can modify the weight value in the opposite direction of the error performance function gradient. Figure2 shows a block chain-based image detection block diagram.Figure 2
Block diagram of image detection based on BP neural algorithm.The training samples of this paper include 9 mineral lamp images, 9 incandescent light bulb images, 9 lamp images, and 50 fire images in total. Select 25 samples of the trained neural network as the input of the neural network, in which 10 flame images, 5 incandescent light bulb images, 5 miner’s lamp images, and 5 car lamp images are collected, and the collection speed is 25 f/s.


## 2.1.1. Step 1: Construct the User-Blockchain Evaluation Matrix

The blockchain is represented by a matrixAm×n, where m represents the specific number of users, n represents the number of blockchains, and the element Ri,j in column j of the i-th row represents the evaluation score of user i on blockchain j. If it satisfies 0<Ri,j≤5, it means that the evaluation is closer to 0, and correspondingly, it means that the user is not aware of the alarm method for this blockchain. If the evaluation value is closer to 5, it means that the user is very high on this blockchain, and 0 means that the user has not responded to this blockchain. Do an assessment. The user-blockchain corresponding evaluation matrix is shown in the following expression :(2)Am×n=R1,1R1,2⋯R1,nR2,1R2,2⋯R2,n⋮⋮⋮Rm,1Rm,2⋯Rm,n.


## 2.1.2. Step 2: Construct the Similarity Matrix

First, the user’s blockchain needs are expressed as an appropriate user alarm mode model, the most general form of which is the user alarm mode vector. Then, the blockchain items to be processed are represented as vectors of the same dimension. Computation of the user’s blockchain requires the similarity between the vector and each blockchain object vector. In order to better represent the user’s alarm mode and reduce the computational complexity, the blockchain purpose feature model and user-sensing alarm mode model are represented by the space vector method. The space vector representation can not only contain the data information of the user’s alarm mode in detail, but also can construct a vector model with this keyword, and complete the weight value of each vector model according to the user’s alarm mode. Combined with the content-blockchain project, it can be divided into two types: text-based blockchain and nontext-based blockchain. Among them, for text-based blockchain projects, the TF-IDF algorithm can be used to calculate the weight value. For nontext blockchain projects, their weights can be calculated with the help of the error value between blockchain attributes and user attributes.For nondocument-type blockchains, the weight of blockchainj for attribute tm is calculated as shown in the following formula:(3)wjm=1,knowledge item i have attributes,0,knowledge item j no attribute.For projects with blockchain attributes, the user’s alarm method does not consider absolute positive or negative, and usually can also represent any value between [0, 1] according to his or her alarm method preference. The weight calculation formula of the feature itemtm is as follows:(4)wim=rtm/arui/b.Among them,wim is used to indicate the degree of user i’s liking for the attribute feature tm of the blockchain, that is, the so-called weight value. If the calculated value is closer to 1, it indicates that the secondary user has a higher interest in the attribute feature tm; rtm represents the sum of the evaluations of the attribute feature tm under the evaluation of user i; and rui represents the sum of all evaluation scores of user i. The sum a, b represent the number of items corresponding to the blockchain evaluation in turn.According to the space vector representation of the function, the alarm mode of useri can be represented by a vector, the feature vector of j in the blockchain can be represented by a vector, t represents the attribute feature in the blockchain Ui=t1,wi1,t2,wi2,…,tm,wim, and w represents the weight of the feature item in the model Vj=t1,wj1,t2,wj2,…,tm,wjm. Then the similarity expression can be obtained as(5)simUi,Vj=cosUi,Vj,=UiVjUiVj,=∑k=1mwikwjk∑k=1mwik2∑k=1mwik2.Process the similarity so that the similarity is numerically consistent with the score:(6)sim′Ui,Vj=5×simUi,Vj.From the calculated similarity, the structural similarity matrixBm×n is shown in the following formula:(7)Bm×n=sim′U1,V1sim′U1,V2⋯sim′U1,Vnsim′U2,V1sim′U2,V2⋯sim′U2,Vn⋮⋮⋮sim′Um,V1sim′Um,V2⋯sim′Um,Vn.


## 2.1.3. Step 3: Construct a New User-Blockchain Evaluation Matrix

According to the evaluation matrix and similarity matrix obtained above, the 0 values that have not been evaluated in the evaluation matrix of the original user-blockchain can be replaced, and can be converted into the values in the corresponding similarity matrix [7, 8], and then the-region block chain evaluation matrix, assuming that the value evaluated by the new matrix is represented by Ri,j′(8)Ri,j′=Ri,j,Ri,j≠0,sim′Ui,Vj,Ri,j=0,,i=1,2,…,m,j=1,2,…,n.Therefore, the new user-blockchain evaluation matrixCm×n is expressed as(9)Cm×n=R1,1′R1,2′⋯R1,n′R2,1′R2,2′⋯R2,n′⋮⋮⋮Rm,1′Rm,2′⋯Rm,n′.


## 2.1.4. Step 4: Retrieve Neighboring Neighbor Evaluation Items

Searching for optimal neighbors is the core content of the algorithm cited in this paper, and the efficiency and effect of this process also affect the efficiency and effect of the push algorithm to a certain extent. Similar to the optimal neighbor mainly refers to the user group that is relatively close to the user group under the current evaluation operation. The similar optimal neighbor is actually a process of building a model in the blockchain, that is, using the evaluation matrixCm×n of the blockchain, The similarity between the user i and the user j is calculated by the similarity algorithm, which can be represented by sim(i, j). The set of blockchains evaluated by user i and user j is represented by Iij, then the corresponding sim(i, j) can be calculated by using the Pearson correlation coefficient. The calculation formula is expressed as follows:(10)simi,j=∑c∈IijRi,c′−Ri′¯Rj,c′−Rj′¯∑c∈IijRi,c′−Ri′¯2∑c∈IijRj,c′−Rj′¯2,Here, the evaluation value of user i to blockchain c in the blockchain evaluation matrix is represented, and the evaluation value of user j to blockchain c in the blockchain evaluation matrix is represented. Ri,c′,Rj,c′,R′¯i, and R′¯j represent the average evaluation values of user i and user j in turn.


## 2.1.5. Step 5: Push the User’s Content Similarity

The degree of similarity that can be calculated can accurately find the similar optimal neighbors of the target user and complete the push to its blockchain. Assuming that the nearest neighbor set of useru is represented by NNu, then the evaluation value of user u to blockchain i, using Pu,i, can borrow the evaluation of the blockchain in the nearest neighbor set NNu of user u, and the calculation process is as follows:(11)Pu,i=Ru′¯+∑n∈NNusimu,n×Rn,i′−Rn′¯∑n∈NNusimu,n.Among them, sim(u, n) represents the similarity between useru and user n, Rn,i′ represents the evaluation of user n on blockchain i, Ru′¯ and Rn′¯ represent the average value of user u and user n on the blockchain in turn.There are two main stages to running the blockchain.(1)
Training phase: In this phase, the input data and output data of the sample are input or output to the blockchain, the weights and thresholds of node connections are learned and modified, and the parameters are optimized by numerical calculation methods until the generated output matches the required value. Required value.(2)
Prediction stage: This stage is mainly used to predict unknown samples. The blockchain is based on gradient descent learning, and the algorithm can modify the weight value in the opposite direction of the error performance function gradient. Figure2 shows a block chain-based image detection block diagram.Figure 2
Block diagram of image detection based on BP neural algorithm.The training samples of this paper include 9 mineral lamp images, 9 incandescent light bulb images, 9 lamp images, and 50 fire images in total. Select 25 samples of the trained neural network as the input of the neural network, in which 10 flame images, 5 incandescent light bulb images, 5 miner’s lamp images, and 5 car lamp images are collected, and the collection speed is 25 f/s.


## 2.2. Fire Detection and Fire Alarm Model

In this paper, the fire alarm system design based on SEED-VIM642 mainly adopts DSP technology. On the basis of sufficient traditional alarm methods, the digital image processing technology is effectively combined to design a fire alarm system. Data is mainly divided into information layer, feature layer, and decision layer (Figure3).Figure 3
Information processing flow of fire alarm system.If there is a fire, the gray value of the image corresponding to the fire scene will change due to the random movement of the fire smoke, and the pixel value of the corresponding fire image will also change differently, and then the gray value will change in a matrix, which changes. This will be accompanied by changes in the values of parameters such as energy, partial changes, and inertia. If the image parameters of the fire scene are represented by x1, x2, x3, and x4 in sequence according to the row vector, the average fluctuation of the change trend of the fire scene image can be expressed as(12)yn=14∑i=1,4xin−xin−1.According to the average energy fluctuation, the change parameters of the fire texture can be judged. The parameter judgment of the fire feature layer is mainly based on the neural network data recognition method. The fire monitoring system constructed by this method can improve the fault tolerance of the system against changes in the environment [9, 10]. The corresponding the network structure is shown in Figure 4.Figure 4
Fire detection and fire alarm model.The network structure of the blockchain is mainly composed of a radial-based network layer and a conflicting network layer. For the pattern classification of small samples in the blockchain-based fire image detection, in general, we choose to use the blockchain based on the process of building small samples and nonlinear models, and choose to use functions and penalty factor. For a given model sampleS1:xi,yi,i=1,2,…,n, the blockchain can be used to transform the problem into:(13)min,Jw,b,e=wTw+12C2∑i=1nei2,s.t,yi=wTφxi+b+ei,i=1,2,…,n.The parameters that can be solved for the blockchain function are expressed as(14)k+C2⋅I1⟶1T⟶0⋅ab=y0.In the process of solving the above problems, the most common method is the conjugate gradient method. This method has the advantages of simple operation and large data storage, and has the advantages of fast convergence speed, and so on. It can better solve the above problems. The conjugate gradient method needs to obtain the search direction, and the step factor as the premise of the calculation. Based on the blockchain, this paper uses the conjugate gradient algorithm to realize the sum of the squares of the sample errors to construct the blockchain model. The process of fire image detection based on blockchain is shown in Figure5.Figure 5
Flowchart of fire image detection based on blockchain.


## 2.3. Flame Image Processing Process

Grayscale conversion: Since the values ofR, G, and B range from 0 to 255, the grayscale level is 256, that is, a grayscale image can only express 256 colors (grayscale). On the other hand, since a grayscale image is easy to handle and convert, the image of the processing object is first converted to a grayscale image. In order to convert into a grayscale image, the weighted average method is used, and the expression is as follows:(15)R=G=B=R×WR+G×WG+B×WB.In the formula,R is red light with a wavelength of 700 nm, G is green light with a wavelength of 546.1 nm, B is blue light with a wavelength of 435.8 nm, WR is the weighted value of red light, WG is the weighted value of green light, and WB is the weighted value of blue light value.According to the principle of three colors, the most reasonable grayscale image is obtained withWR = 0.30, WG = 0.59, and WB = 0.11. Using the weighted average method, as shown in Figure 6, the 24 bit true color image of the flame was converted to a grayscale image.Figure 6
Grayscale image of flame.


### 2.3.1. Binarization of Images

The image binarization process is essentially a kind of image segmentation method. The effect of binarization enhances the contrast of the image. The binary image is the basis for the subsequent target recognition. Therefore, it is important to obtain a binary image with less interference pixels. The most important problem in the binarization process is obviously the problem of threshold selection.(1) Iterative threshold method. The threshold iteration scheme can automatically search for a relatively suitable threshold through the program. If the iterations are repeated in this way, there is no change in the switching function, i.e., if the iterations converge to a stable threshold, the current threshold is used as the final result of image segmentation. The iterative look at equation:(16)Ti+1=12∑k=0Tihk∘k∑k=0Tihk+∑k=Ti+1L−1hk∘k∑k=Ti+1L−1hk.Ti in the expression represents the threshold value of the image solution for the i-th iteration; L represents the number of gray levels; and hk represents the number of pixels with a gray value of k. The binarized image solved using the above method is shown in Figure 7.Figure 7
Binarized image by iterative threshold method.(2) Maximum inter-class variance method. The basic idea of the maximum interclass dispersion method is to use the grayscale histogram of the image to dynamically determine the segmentation threshold of the image with the aim of maximizing the dispersion of the target and the background. The operation process is as follows: take a gray value, use the gray value as the boundary, divide the image into two gray value sizes, and calculate the number of pixels and the gray average value of the two types, respectively. Next, these interclass dispersions are calculated, and finally the gray level corresponding to the maximum value of all gray level interclass dispersions is used as a threshold. The quoted formula (17) for calculating the variance between classes:(17)ωi=n1in2iv1i−v2i2.In the expression,n1i and n2i are the pixels whose grayscale is less than i, the number of pixels whose image is not less than i, v1i and v2i represent the corresponding average values of n1i and n2i in turn. ω(i) is expressed as a function of the gray value of the image as a parameter, and the function value of the solution image is set as the maximum value, that is, the binarization threshold of the image corresponding to the case where ω(i) and the maximum value are solved is shown in the following expression:(18)T=ArgMaxωi.Among them,T represents the segmentation threshold of the binarization of the image.Figure8 shows a binarized image obtained by the maximum interclass dispersion method.Figure 8
Binarized image with maximum between-class variance method.Comparing Figures7 and 8, it can be seen that the maximum interclass dispersion method can better achieve the separation of flame and background.In order to highlight the characteristics of the flame in the image, the small flames in the image need to be removed, and this can be achieved using erosion and dilation algorithms in mathematical formal processing. As shown in Figure9(b), Figure 9 shows a processing example of performing an etching operation on a target image using structural elements to obtain a calculation result (as shown in Figure 9(c)).Figure 9
Image erosion operation process.
(a)(b)(c)Figure10(a) is the original image, the constituent elements used here are crosses (as shown in Figure 10(b)), and Figure 10(c) is obtained after the expansion process. The pixels represented by black are new pixels that are generated by expansion that do not belong to the original target, and the pixels represented by gray are the position of the original image. As can be seen from Figure 10, dilation merges all background points in contact with the target to the target, the direct result of which is to expand the coverage area on the boundary by augmenting the original target image. Figures 11 and 12 show the results of the etching and dilation calculations of the flame binarized image.Figure 10
Image dilation operation process.
(a)(b)(c)Figure 11
Image erosion results.Figure 12
Image dilation result.The method described in this article can be operated through the following steps. For images with inconsistent formats from a wide range of sources, they need to be converted into grayscale images first; after binarization, they are converted into black and white bitmaps; finally, image morphological methods are used to remove noise. Remove furniture outside the building and objects of the text introduction class. Therefore, in different cases, most of the building interior plans are in the form of “horizontal, horizontal and vertical”, and the Hough method is used to convert two important directions. By rotating the obtained image around thex-axis and y-axis, the image block is obtained to improve the vectorization efficiency of the image.The software research of image manipulation function is the process of blockchain object identification and processing. When 3D products are operated in image recognition technology, first of all, it is necessary to obtain the feature values of the target through target expansion training, and establish an effective and useful feature map [3, 11]. During the operation of the system, the feature value of the current operand is obtained, which is consistent with the feature map to achieve the purpose of identifying the target object. Figure 13 shows the flow of the image processing module.Figure 13
The software design flow of the image processing module.As shown in Figure13, 3D modeling products require image preprocessing during image processing, which is also used to minimize image data and improve the detectability of useful information. Image segmentation is the technique and process of segmenting an image into several specific regions with unique properties and proposing objects of interest. Create a feature map consistent with image attribute values, extract the target object, and find the most effective attribute from multiple features. Image matching refers to the comparison between the extracted feature quantity and the feature mapping table to achieve the purpose of target object recognition.


### 2.3.2. Region Blocking Based on Integral Projection

After the preprocessing is completed, in order to quickly segment each wall region, the average integral projection function is used to extract the image region containing the wall line. If there is a change in the pixel gray mean value of a column (row) of an image, the change will respond to the mean integral projection value of the column (row) [12, 13]. The mean integral projection function is shown in the following equation:(19)Mvx=1y2−y1∫y1y2Ix,ydy,Mhy=1x2−x1∫x1x2Ix,ydx.Here, I(x, y) ice point (x, y) pixel gray value; Mv(x)[y1, y2] presents the vertical mean integral projection function in the interval. Mh(y)[x1, x2] represents the horizontal mean integral projection function in the interval.(20)Mv′y=Mvx−minMvxmaxMvx−minMvx,Mh′x=Mhx−minMhxmaxMhx−minMhx.


### 2.3.3. Block Image Vectorization

Through the integration head-type process, the whole image is divided into multiple word images, and each subimage includes multiple vertical or horizontal image units and some architectural data of the wall geometry are obtained through the line segment coupling of the postoperation bandwidth. Therefore, for the characteristics of these subimages, the advantages of the traditional SPV method and calculation level are maintained, in which the SPV is not in place in the recognition of the axes and small structures in the picture, and the discrimination ability of the intersection of lines is calculated. The adjustment is proposed and applied to separate images, which is helpful for the recognition and vectorization efficiency of graphics. The central points are detailed below.(1) Selection of axis point and tracking direction. In the vectorization method used above, by searching for the axis points, the scan lines are scanned from the upper and lower sides of the preset block binary image. If the first black pixel point to be scanned is P0, scan to the right from P0 until the first white pixel point P0 and 39, and obtain the horizontal running midpoint P1 at the same time. Then, start from P1 and scan twice in the opposite direction from the vertical direction, passing through the midpoint P2 in the vertical direction. Similarly, it is necessary to ensure that the distance from P2 to the midpoint P3 of horizontal operation is less than the previously set value. The value of PiPi−1 is generally 1 pixel. Therefore the Pi point is defined as the pivot point. Through the experiment, get the correct starting axis point and repeat 3∼5 steps normally.After passing the axis pointPi, the horizontal and vertical values Pi of the point are obtained. If the width in the horizontal direction and the width in the vertical direction are longer, the inclination of the line in the horizontal direction is less than 45°, and the length direction of the line segment is considered to be horizontal, otherwise the length direction is vertical. The width and length directions of the segments intersect. In this method, determining the length direction is the determining direction of the post-tracking procedure.(2) Determine the sparse point. Through the length of the action, the search is carried out. Assuming the length action is horizontal then the search direction is from right to left; assuming the length action is vertical, it should be from bottom to top. Figure 13 shows that it is found that not long is the previously determined value, through the current P4 (P’4), and then moves the red arrow direction to the tracking step and then moves it to the black pixel value. Continue and trace the vertical behavior in both directions through this value, while crossing the white pixel values P5l and P5rP5u and P5d. Calculate the series number P5 (P’5) of the white pixel value, which is a new central axis number, and the value of the record point line width is cut off tracking. If three conditions are met at the same time, a new query needs to be started from this point [14–16].(1)
The line width difference between the new central axis number and the previous central axis number is within the receiving range;(2)
The new central axis number has never been queried;(3)
The real search step is greater than the value 0.In image connections such as intersection regions, branches, rotation angles, the node segmentation procedure is usually executed in violation of these three conditions.(3) Node segmentation. If you violate one or more of the keep track conditions, the sparse point tracker will pause and node splitters, such as segment intersections and corners, will be enabled. Node segmentation is repeated in the following 3 steps [17, 18].(1)
Return to the previous central axis point;(2)
Adjust the tracking step to half of the current step.(3)
Detect the continue condition at the new location.When the detection fails, halve the step size and repeat. However, if the point at the new location satisfies all the conditions to resume the original tracking step from that point, the tracking is performed. The repeated tracking step size is 0, the node segmentation process ends, and all the conditions found at the end are satisfied to be the new central axis point. Through such processing, the program can divide the cross area into 3 straight line segments more accurately with the intersection as the boundary, and the corner polyline can be divided into two very accurately.(4) Line segment integration. Because of the factor of image quality and line segment intersection, the original line to be connected is vectorized and divided into multiple separated line segments. To deal with this situation, it is necessary to combine the next line segments to achieve the combination of line segments connected at the same time in a horizontal line with the same line width. Import the line segment to be solved, with the structure of start, end coordinate direction, and line width data [19]. By using the end coordinates to remove the start coordinates, the number of each line segment can be obtained, and the value of each two angles can be calculated by vector calculation. If the angles of the two vectors are similar to 0, it can be concluded that the central axes of the two line segments are almost parallel. Assuming that the two parallel close distances are smaller than the predetermined line width, the two straight lines are combined, and the intersection segment through the node segmentation procedure is integrated into a complete line.


## 2.3.1. Binarization of Images

The image binarization process is essentially a kind of image segmentation method. The effect of binarization enhances the contrast of the image. The binary image is the basis for the subsequent target recognition. Therefore, it is important to obtain a binary image with less interference pixels. The most important problem in the binarization process is obviously the problem of threshold selection.(1) Iterative threshold method. The threshold iteration scheme can automatically search for a relatively suitable threshold through the program. If the iterations are repeated in this way, there is no change in the switching function, i.e., if the iterations converge to a stable threshold, the current threshold is used as the final result of image segmentation. The iterative look at equation:(16)Ti+1=12∑k=0Tihk∘k∑k=0Tihk+∑k=Ti+1L−1hk∘k∑k=Ti+1L−1hk.Ti in the expression represents the threshold value of the image solution for the i-th iteration; L represents the number of gray levels; and hk represents the number of pixels with a gray value of k. The binarized image solved using the above method is shown in Figure 7.Figure 7
Binarized image by iterative threshold method.(2) Maximum inter-class variance method. The basic idea of the maximum interclass dispersion method is to use the grayscale histogram of the image to dynamically determine the segmentation threshold of the image with the aim of maximizing the dispersion of the target and the background. The operation process is as follows: take a gray value, use the gray value as the boundary, divide the image into two gray value sizes, and calculate the number of pixels and the gray average value of the two types, respectively. Next, these interclass dispersions are calculated, and finally the gray level corresponding to the maximum value of all gray level interclass dispersions is used as a threshold. The quoted formula (17) for calculating the variance between classes:(17)ωi=n1in2iv1i−v2i2.In the expression,n1i and n2i are the pixels whose grayscale is less than i, the number of pixels whose image is not less than i, v1i and v2i represent the corresponding average values of n1i and n2i in turn. ω(i) is expressed as a function of the gray value of the image as a parameter, and the function value of the solution image is set as the maximum value, that is, the binarization threshold of the image corresponding to the case where ω(i) and the maximum value are solved is shown in the following expression:(18)T=ArgMaxωi.Among them,T represents the segmentation threshold of the binarization of the image.Figure8 shows a binarized image obtained by the maximum interclass dispersion method.Figure 8
Binarized image with maximum between-class variance method.Comparing Figures7 and 8, it can be seen that the maximum interclass dispersion method can better achieve the separation of flame and background.In order to highlight the characteristics of the flame in the image, the small flames in the image need to be removed, and this can be achieved using erosion and dilation algorithms in mathematical formal processing. As shown in Figure9(b), Figure 9 shows a processing example of performing an etching operation on a target image using structural elements to obtain a calculation result (as shown in Figure 9(c)).Figure 9
Image erosion operation process.
(a)(b)(c)Figure10(a) is the original image, the constituent elements used here are crosses (as shown in Figure 10(b)), and Figure 10(c) is obtained after the expansion process. The pixels represented by black are new pixels that are generated by expansion that do not belong to the original target, and the pixels represented by gray are the position of the original image. As can be seen from Figure 10, dilation merges all background points in contact with the target to the target, the direct result of which is to expand the coverage area on the boundary by augmenting the original target image. Figures 11 and 12 show the results of the etching and dilation calculations of the flame binarized image.Figure 10
Image dilation operation process.
(a)(b)(c)Figure 11
Image erosion results.Figure 12
Image dilation result.The method described in this article can be operated through the following steps. For images with inconsistent formats from a wide range of sources, they need to be converted into grayscale images first; after binarization, they are converted into black and white bitmaps; finally, image morphological methods are used to remove noise. Remove furniture outside the building and objects of the text introduction class. Therefore, in different cases, most of the building interior plans are in the form of “horizontal, horizontal and vertical”, and the Hough method is used to convert two important directions. By rotating the obtained image around thex-axis and y-axis, the image block is obtained to improve the vectorization efficiency of the image.The software research of image manipulation function is the process of blockchain object identification and processing. When 3D products are operated in image recognition technology, first of all, it is necessary to obtain the feature values of the target through target expansion training, and establish an effective and useful feature map [3, 11]. During the operation of the system, the feature value of the current operand is obtained, which is consistent with the feature map to achieve the purpose of identifying the target object. Figure 13 shows the flow of the image processing module.Figure 13
The software design flow of the image processing module.As shown in Figure13, 3D modeling products require image preprocessing during image processing, which is also used to minimize image data and improve the detectability of useful information. Image segmentation is the technique and process of segmenting an image into several specific regions with unique properties and proposing objects of interest. Create a feature map consistent with image attribute values, extract the target object, and find the most effective attribute from multiple features. Image matching refers to the comparison between the extracted feature quantity and the feature mapping table to achieve the purpose of target object recognition.


## 2.3.2. Region Blocking Based on Integral Projection

After the preprocessing is completed, in order to quickly segment each wall region, the average integral projection function is used to extract the image region containing the wall line. If there is a change in the pixel gray mean value of a column (row) of an image, the change will respond to the mean integral projection value of the column (row) [12, 13]. The mean integral projection function is shown in the following equation:(19)Mvx=1y2−y1∫y1y2Ix,ydy,Mhy=1x2−x1∫x1x2Ix,ydx.Here, I(x, y) ice point (x, y) pixel gray value; Mv(x)[y1, y2] presents the vertical mean integral projection function in the interval. Mh(y)[x1, x2] represents the horizontal mean integral projection function in the interval.(20)Mv′y=Mvx−minMvxmaxMvx−minMvx,Mh′x=Mhx−minMhxmaxMhx−minMhx.


## 2.3.3. Block Image Vectorization

Through the integration head-type process, the whole image is divided into multiple word images, and each subimage includes multiple vertical or horizontal image units and some architectural data of the wall geometry are obtained through the line segment coupling of the postoperation bandwidth. Therefore, for the characteristics of these subimages, the advantages of the traditional SPV method and calculation level are maintained, in which the SPV is not in place in the recognition of the axes and small structures in the picture, and the discrimination ability of the intersection of lines is calculated. The adjustment is proposed and applied to separate images, which is helpful for the recognition and vectorization efficiency of graphics. The central points are detailed below.(1) Selection of axis point and tracking direction. In the vectorization method used above, by searching for the axis points, the scan lines are scanned from the upper and lower sides of the preset block binary image. If the first black pixel point to be scanned is P0, scan to the right from P0 until the first white pixel point P0 and 39, and obtain the horizontal running midpoint P1 at the same time. Then, start from P1 and scan twice in the opposite direction from the vertical direction, passing through the midpoint P2 in the vertical direction. Similarly, it is necessary to ensure that the distance from P2 to the midpoint P3 of horizontal operation is less than the previously set value. The value of PiPi−1 is generally 1 pixel. Therefore the Pi point is defined as the pivot point. Through the experiment, get the correct starting axis point and repeat 3∼5 steps normally.After passing the axis pointPi, the horizontal and vertical values Pi of the point are obtained. If the width in the horizontal direction and the width in the vertical direction are longer, the inclination of the line in the horizontal direction is less than 45°, and the length direction of the line segment is considered to be horizontal, otherwise the length direction is vertical. The width and length directions of the segments intersect. In this method, determining the length direction is the determining direction of the post-tracking procedure.(2) Determine the sparse point. Through the length of the action, the search is carried out. Assuming the length action is horizontal then the search direction is from right to left; assuming the length action is vertical, it should be from bottom to top. Figure 13 shows that it is found that not long is the previously determined value, through the current P4 (P’4), and then moves the red arrow direction to the tracking step and then moves it to the black pixel value. Continue and trace the vertical behavior in both directions through this value, while crossing the white pixel values P5l and P5rP5u and P5d. Calculate the series number P5 (P’5) of the white pixel value, which is a new central axis number, and the value of the record point line width is cut off tracking. If three conditions are met at the same time, a new query needs to be started from this point [14–16].(1)
The line width difference between the new central axis number and the previous central axis number is within the receiving range;(2)
The new central axis number has never been queried;(3)
The real search step is greater than the value 0.In image connections such as intersection regions, branches, rotation angles, the node segmentation procedure is usually executed in violation of these three conditions.(3) Node segmentation. If you violate one or more of the keep track conditions, the sparse point tracker will pause and node splitters, such as segment intersections and corners, will be enabled. Node segmentation is repeated in the following 3 steps [17, 18].(1)
Return to the previous central axis point;(2)
Adjust the tracking step to half of the current step.(3)
Detect the continue condition at the new location.When the detection fails, halve the step size and repeat. However, if the point at the new location satisfies all the conditions to resume the original tracking step from that point, the tracking is performed. The repeated tracking step size is 0, the node segmentation process ends, and all the conditions found at the end are satisfied to be the new central axis point. Through such processing, the program can divide the cross area into 3 straight line segments more accurately with the intersection as the boundary, and the corner polyline can be divided into two very accurately.(4) Line segment integration. Because of the factor of image quality and line segment intersection, the original line to be connected is vectorized and divided into multiple separated line segments. To deal with this situation, it is necessary to combine the next line segments to achieve the combination of line segments connected at the same time in a horizontal line with the same line width. Import the line segment to be solved, with the structure of start, end coordinate direction, and line width data [19]. By using the end coordinates to remove the start coordinates, the number of each line segment can be obtained, and the value of each two angles can be calculated by vector calculation. If the angles of the two vectors are similar to 0, it can be concluded that the central axes of the two line segments are almost parallel. Assuming that the two parallel close distances are smaller than the predetermined line width, the two straight lines are combined, and the intersection segment through the node segmentation procedure is integrated into a complete line.


## 3. Experiment and Result Analysis

Figure14 shows the hardware structure of the fire alarm system. The model of the temperature sensor is CHD301C smoke sensing instrument model CHD-LH93, which is connected to the RS485 serial port of the SEED-VFM 642 development platform through the RS485 bus. Each sensor is connected to the 485 bus with a 1-to-20 Ω resistance, and data collection errors due to the failure of a single sensor can be avoided. The sensor at the end of the RS485 bus can improve the reliability of the RS485 bus communication by connecting a 120-Ω resistance to the terminal in parallel.Figure 14
Fire test image.Figure15 shows the characteristic parameter change curve in the fire experiment.Figure 15
Characteristic parameters of fire experiment. (a) Texture average volatility, (b) average temperature, and (c) average smoke concentration.
(a)(b)(c)In Figure15(a), there are obvious differences in the average fluctuations of texture parameters before and after the fire: before the fire, the average fluctuations of the texture parameters are relatively mild and relatively small; relatively large, the characteristic of this change is the manifestation of the out-of-control state after the fire. Therefore, the average variation of texture feature parameters can be used to quickly identify fires. In Figures 15(b) and 15(c), the temperature data began to rise from 4.32 s after the fire, and the smoke density data began to rise 12.16 s after the fire. The upward trend of these two parameters can also be used separately to identify fires.The second group of experiments was the nighttime fluorescent light interference experiment. During the experiment, 1639 frames of images were collected, and the fluorescent light was turned on before the experiment. The 369th frame corresponds to the time when the fluorescent lamp is turned off, the 680th frame corresponds to the time when the fluorescent lamp is turned on, and the 1086th frame corresponds to the time when the fluorescent lamp is turned off again. The experimental characteristic parameter change curve is shown in Figure16.Figure 16
Characteristic parameters of fluorescent lamp interference experiment.The third group of experiments was the alcohol lamp interference experiment during the day. During the experiment, 660 frames of images were collected, of which 370 frames of images corresponded to the lighting time of the alcohol lamp. The experimental characteristic parameter change curve is shown in Figure17.Figure 17
Characteristic parameters of alcohol lamp interference experiment.Figures16 and 17 show that step changes occur in the texture parameters of the images of the two frames before and after the lighting of the fluorescent lamp and before and after the lighting of the alcohol lamp, and the average variation of the texture parameters suddenly increases and then suddenly decreases. This feature is significantly different from the average variation in the texture parameters of fire images and can be used to distinguish fire or disturbance. The second peak in Figure 17 is mainly affected by wind.In the experimental process of this paper, we choose to monitor the fluctuation of the average value of the fire image texture based on the blockchain, judge the temperature and smoke density of the on-site fire, and select the fire trend in turn to judge the trend of the fire. The samples of the blockchain input variables are mainly the average texture fluctuations corresponding to 50 consecutive frames of images containing fire images. The fire data obtained during the first experiment collected 659 frames of images. After image processing, 658 texture average fluctuations can be obtained. At the same time, the fire data information contained in the corresponding fire input samples can be input with 628 samples, which can improve the recognition accuracy of the fire. The output of the blockchain sample is mainly based on the state change of the current fire scene image, that is, when the fire occurs. The fire is represented by 1, and 0 is used in the case of no fire. The output sample does not include the 50 frames of fire images used for testing. In this paper, based on a large number of fire experiments, the sample data is trained and the texture parameters are identified. The sample test during the experiment, as shown in Figure18, the images corresponding to the 264 frames in the image are mainly based on the fire detected by the blockchain, and the response time is 1.1 s, so the fire alarm system with the fire image can accurately detect fire conditions.Figure 18
Classification results of fire experiments.In this paper, a threshold algorithm is used to identify the smoke concentration, and the threshold is 50%. In the first set of experiments, the moment of recognizing the fire under the temperature is the corresponding moment of the 339th frame image, and the reaction time is about 13.3 s, and the moment of recognizing the fire under the smoke density is the moment corresponding to the 369th frame image, and the reaction time is about 18.1 s. In the experiments of groups 2 and 3, the temperature and smoke density did not change, and the classification results were all nonfire patterns. To sum up, Table1 shows the combination of fire alarm system outputs during the first set of experiments.Table 1
Combinations of three recognition results.
Before frame 263Frames 263∼338Frames 339∼368After frame 369Texture recognition results0111Temperature recognition result0011Smoke recognition results0001Table1 illustrates that the identification results of texture parameters can provide early warning of fire, the identification results of temperature and smoke density data are used to confirm the occurrence of fire, and the interference prevention of fire alarm system can be improved.


## 4. Conclusion

In this paper, fire detection and fire alarm are studied in detail, and a computational model is proposed. This lightweight computation method can provide efficient block segmentation for the features of fire detection and fire alarm, and can improve the speed of vectorization. According to the discrimination of fire detection and fire alarm, blockchain technology is adopted, and corresponding calculation measures are given to ensure the accuracy of the background, and also improve the work efficiency. This method analyzes the process, can adjust the parameters intuitively, effectively detects and alarms fires, and saves and reads information more conveniently. It can also speed up fires in critical locations. High reliability detection. The fire alarm system based on this method has proved through experiments that it can detect fire correctly and quickly, and identify the interference sources such as fluorescent lamps and alcohol lamps, and has strong interference.



---

*Source: 9304991-2022-07-13.xml*