Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
The term used in embodiments of the present invention is only to be not intended to be limiting merely for for the purpose of describing particular embodiments
The present invention.In the embodiment of the present invention and the "an" of singular used in the attached claims, " described " and "the"
It is also intended to including most forms, unless the context clearly indicates other meaning, " a variety of " generally comprise at least two, but not
It excludes to include at least one situation.
It should be appreciated that term "and/or" used herein is only a kind of incidence relation for describing affiliated partner, indicate
There may be three kinds of relationships, for example, A and/or B, can indicate: individualism A, exist simultaneously A and B, individualism B these three
Situation.In addition, character "/" herein, typicallys represent the relationship that forward-backward correlation object is a kind of "or".
Depending on context, word as used in this " if ", " if " can be construed to " ... when " or
" when ... " or " in response to determination " or " in response to detection ".Similarly, context is depended on, phrase " if it is determined that " or " such as
Fruit detection (condition or event of statement) " can be construed to " when determining " or " in response to determination " or " when detection (statement
Condition or event) when " or " in response to detection (condition or event of statement) ".
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
Include, so that commodity or system including a series of elements not only include those elements, but also including not clear
The other element listed, or further include for this commodity or the intrinsic element of system.In the feelings not limited more
Under condition, the element that is limited by sentence "including a ...", it is not excluded that in the commodity or system for including the element also
There are other identical elements.
In addition, the step timing in following each method embodiments is only a kind of citing, rather than considered critical.
Fig. 1 is the flow diagram of fire detection method provided in an embodiment of the present invention, carries out the master of inside fire detection
The step is wanted to include:
101: depth image and infrared image are obtained by TOF depth mould group.
It is readily appreciated that, TOF (Time of flight) depth mould group emits infrared light, and shooting obtains the depth in same frame
Image and infrared image.In practical applications, it when obtaining image by TOF depth mould group, is continuously acquired according to the frequency of setting.
When carrying out image comparison, can be and compare continuous adjacent two field pictures, can also by present image with prestore before this
Reference picture compare.
102: comparing the depth image and preset reference depth image, obtain the first comparing result.
Preset reference depth image mentioned here refers to the previous frame depth map of the depth information image currently obtained
Picture.When comparing, need according to multiple real-time collected present images respectively with the preset reference image of former frame into
Row comparison.
Specifically, the depth image got in real time and preset reference depth image are carried out to the comparison of gray value.Meter
The difference for calculating current depth image and its former frame depth image (i.e. preset reference depth image), seeks its quadratic sum, as it
Difference value calculates the sum of the difference value of continuous multiple frames.
If there are the depth information values of continuous multi-amplitude deepness image and preset reference depth image (respective former frame depth
Image) gray value is compared there is significantly jumping phenomena (that is, gray scale difference value is more than the first preset threshold), then it can determine that the position
Depth information value up and down change greatly, present unstable state, then the difference value of continuous multiple frames depth image and it is larger, surpass
Cross the depth difference threshold value of setting, then it is assumed that fire may occur, if conversely, then thinking that generation fire is not detected.
103: comparing the infrared image and preset reference infrared image, obtain the second comparing result.
Preset reference infrared image mentioned here is in fire detection equipment (comprising infrared image acquisition mould group and red
Outer Image Acquisition mould group) it is mounted on after designated position, the image not occurred under fire conditions is obtained by TOF mould group, as
Preset reference infrared image.In order to enable the preset reference infrared image obtained has better reference role, it will usually acquire
Multiple reference ir images, and equalization processing is carried out to the pixel value of multiple images.
Specifically, it is assumed that the infrared image resolving power by the acquisition of infrared image mould group is 1280*720, it is assumed that is obtained
Reference ir image m;Further, according to this m images, the corresponding gray value of each pixel is successively calculated.To calculate
For the gray value of one of pixel, it is assumed that the gray value for calculating (0,0) point utilizes formula Average=1/m* ∑
Vali (val: pixel value;I=1,2 ... .n).After the gray value for obtaining each pixel, the available infrared figure of preset reference
Picture.
Further, the infrared image got in real time and preset reference infrared image are carried out to the comparison of gray value.Hold
Readily understood, the first comparing result mentioned here is infrared image gray value respectively more than with reference to infrared figure there are two kinds of situations
As gray value, in other words, fire may be occurred by detecting;Another kind is that infrared image gray value is less than reference ir image ash
In other words generation fire is not detected in angle value.
104: according to second comparing result and multiple continuous first comparing results, it is determined whether there are fire.
Judge whether to occur alternatively, needing further to judge the first comparing result and second pair in order to more accurate
It is whether more consistent than result.It further, is to need to obtain multiple continuous first pairs carrying out judgement based on the first comparing result
Than as a result, multiple continuous first comparing results are all then to be labeled as doubtful generation fire more than the first preset threshold if it exists,
Multiple continuous first comparing results are all less than the first preset threshold if it exists, then mark without doubtful fire.
For example, when the first comparing result is the numerical value change that larger floating occurs for depth image depth information (gray value)
(in other words, the first comparing result looked into the first preset threshold), the first comparing result of expression is doubtful generation fire, if depth map
The gray value of picture is stablized, close with reference depth gray value of image, then it represents that fire does not occur for the first comparing result;When second pair
When than result being that the corresponding gray value of infrared image is more than the corresponding gray value of preset reference infrared image, the second comparison knot is indicated
Fruit is doubtful generation fire, indicates that fire does not occur for the second comparing result if being less than.
Further, only the first comparing result is doubtful generation fire, the second comparing result is also doubtful generation fire
In the case where, final output is to determine that fire occurs.It can effectively improve the accuracy for fire detection in this way.
In one or more embodiment of the invention, the acquisition depth image and infrared image specifically be can wrap
It includes: depth image and infrared image is obtained based on the TOF depth mould group in real time;Wherein, the depth image and described infrared
Image is obtained in same frame.
In order to ensure the reliability of comparing result, in the detection process, the frequency of the image obtained in real time be can be 1 second
It obtains once, the frequency of acquisition image can also be adjusted according to the difference of period;For example, personnel on daytime are in case, adopt
Collection frequency can be one minute once, if evening personnel come off duty, adjustable frequency acquisition is one second primary.
In one or more embodiment of the invention, the comparison depth image and preset reference depth map
Picture obtains the first comparing result, can specifically include: dividing the depth image, obtains the first depth block image;Label institute
State each depth block index number in the first depth block image;The preset reference depth image is divided, obtains first with reference to deep
Spend block image;Mark each depth block index number in the first reference depth block image;According to the depth piecemeal rope
Quotation marks compare the piecemeal in the first depth block image and the first reference depth block image;Obtain first
Comparing result.
It should be noted that can be one-to-one when comparing depth image and preset reference depth image
Comparison, for example, the depth image currently obtained and former frame depth image (preset reference depth image) are carried out in pairs
Than;Can also with multiframe depth image compared with preset reference depth image.
Specifically, for example, as illustrated in fig. 2, it is assumed that the resolving power of depth image and preset reference depth image is 400*
300, which can be divided, it is 12 pieces total to be divided into 4*3.Further, to each separately number of being indexed
Label, for example, according to from left to right, sequence from top to bottom is successively labeled as 1~12.
When comparing, the gray value of separated image corresponding to same call number can be compared.For example, will
The block diagram that call number is 8 in the block image and preset reference depth image that call number is 8 in the depth image obtained in real time
The gray value of picture compares.It should be noted that when carrying out gray value comparison, can each pixel successively carry out pair
Than to put it more simply, can also be compared in the hope of the gray average of each block image using mean value.
It is described according to the depth block index number in one or more embodiment of the invention, compare described the
The piecemeal in one depth block image and the first reference depth block image, can specifically include: obtain described the
First gray average of the corresponding piecemeal of each depth block index number in one depth block image;Obtain first reference
First reference gray level mean value of the corresponding piecemeal of each depth block index number in depth block image;According to the depth point
Block call number, successively the depth gray scale difference between first gray average and the corresponding first reference gray level mean value
Value.With this principle, the depth gray scale difference value of the first depth image of continuous multiple frames and the first reference depth image is calculated.
As illustrated in fig. 2, it is assumed that the image that resolving power is 400*300 is divided into 4*3 block image.Every piece of resolving power is
100*100, it is possible to further utilize AVG=1/n ∑ vali (i=1-10000).It is assumed that corresponding first ash of depth image
Degree mean value is AVG1, and the corresponding first reference gray level mean value of former frame depth image (preset reference depth image) is AVG2, is connect
Get off and made the difference with AVG1 and AVG2, obtains depth gray difference value AVG3;Further calculate the depth map of continuous multiple frames
The depth gray difference value of picture;
In one or more embodiment of the invention, the first comparing result of the acquisition be can specifically include: according to
First preset threshold, and the depth gray difference value and compares;If the depth gray difference value and being greater than described the
One preset threshold then obtains the corresponding depth block index number, obtains the first comparing result.
Assuming that the first preset threshold is AVG4, after obtaining depth gray scale difference value AVG3, AVG4 and AVG3 are carried out pair
Than.It is assumed that when multiple continuous AVG3 are greater than AVG4, it is believed that doubtful fire occurs, then further, needs to obtain corresponding
The separated call number of depth, the first comparing result are corresponding with call number.
In one or more embodiment of the invention, the comparison infrared image and the infrared figure of preset reference
Picture obtains the second comparing result, can specifically include: dividing the infrared image, obtains the first infrared block image;Label institute
State each infrared block index number in the first infrared block image;The preset reference infrared image is divided, obtains first with reference to red
Outer block image;Mark each infrared block index number in the infrared block image of first reference;According to the infrared piecemeal rope
Quotation marks compare the first infrared block image and described first with reference to the piecemeal in infrared block image;Obtain second
Comparing result.
For example, it is assumed that the resolving power of infrared image and preset reference infrared image is 400*300, it can be by two images
It is divided, it is 12 pieces total to be divided into 4*3.Further, to the label of each separately number of being indexed, for example, according to from a left side
To the right side, sequence from top to bottom is successively labeled as 1~12.
When comparing, the gray value of separated image corresponding to same call number can be compared.For example, will
The piecemeal that call number is 10 in the block image and preset reference infrared image that call number is 10 in the infrared image obtained in real time
The gray value of image compares.It should be noted that when carrying out gray value comparison, can each pixel successively carry out pair
Than to put it more simply, can also be compared in the hope of the gray average of each block image using mean value.
It is described according to the infrared block index number in one or more embodiment of the invention, compare described the
One infrared block image and described first can specifically include with reference to the piecemeal in infrared block image: obtain described the
First infrared gray average of the corresponding piecemeal of each infrared block index number in one infrared block image;Obtain described first
First with reference to the corresponding piecemeal of the infrared block index number each in infrared block image refers to infrared gray average;According to institute
Infrared block index number is stated, successively the more described first infrared gray average and corresponding described first refers to infrared gray average
Between infrared gray scale difference value.
Assuming that the image that resolving power is 400*300 is divided into 4*3 block image.Every piece of resolving power is 100*100, into one
Step ground, can use AVG=1/n ∑ vali (i=1-10000).It is assumed that corresponding second gray average of infrared image is
AVG5, the corresponding second reference gray level mean value of reference ir image is AVG6, is next made the difference, is obtained red with AVG5 and AVG6
Outer gray scale difference value AVG7.
In one or more embodiment of the invention, the second comparing result of the acquisition be can specifically include: according to
Second preset threshold is compared with the infrared gray scale difference value;If the infrared gray scale difference value is greater than the described second default threshold
Value then obtains the corresponding infrared block index number, obtains the second comparing result.
Assuming that the second preset threshold is AVG8, after obtaining infrared gray scale difference value AVG7, AVG8 and AVG7 are carried out pair
Than.Size relation between infrared gray scale difference value mentioned here and the second preset threshold can be according to artificial settings, in reality
In the application of border, since difference is there are positive and negative, so the condition of fire occurs as judgement, it can be infrared gray scale difference value and be greater than the
Two preset thresholds are also possible to infrared gray scale difference value less than the second preset threshold.It is assumed that when infrared gray scale difference value is greater than second in advance
If when threshold value, it is believed that doubtful fire occurs, then further, needs to obtain corresponding infrared separated call number, the second comparison
It as a result is corresponding with call number.
It is described according to second comparing result and multiple continuous described in one or more embodiment of the invention
First comparing result, it is determined whether there are fire, can specifically include: if multiple continuous first comparing results and described
Second comparing result is there are fire, and the depth block index number is corresponding with the infrared block index number, then really
Surely there is fire.
In order to promote the accuracy of testing result, comprehensive first comparing result and the second comparing result are needed, only when more
A continuous first comparing result be judged as it is doubtful occur alternatively, and the second comparing result be judged as it is doubtful occur fire feelings
Under condition, it can be determined that for fire occurs.
In one or more embodiment of the invention, further includes: if it is determined that there are fire, according to set spatial position
With the corresponding relationship between the depth image and/or the infrared image, the spatial position that fire occurs is determined.
For example, as shown in Figure 3, it is assumed that fire detection device 1 is mounted on the room A1, and fire detection device 2 is mounted on the room A2
Between.After fire detection device 1 detects, and fire occurs, which can send out to control device or staff
Inspection measures the device number and corresponding room number of the fire, so that staff is quickly found out the room of generation fire,
And carry out fire-fighting work.
Further, if monitored space is bigger, such as large conference room or bulk storage plant, it is also necessary to it establishes each
The relationship of piecemeal and real space position.It is assumed that the block image correspondence that piecemeal number is 1 is the doorway in warehouse, piecemeal number
For 2 block image it is corresponding be file cabinet.When being alarmed, piecemeal can be numbered and be sent to work people together
Member, to realize more accurate alarm.
Based on same thinking, a kind of fire detection device, as shown in figure 4, the device includes:
Module 41 is obtained, for obtaining depth image and infrared image by TOF depth mould group;
First contrast module 42 obtains the first comparison knot for comparing the depth image and preset reference depth image
Fruit;
Second contrast module 43 obtains the second comparison knot for comparing the infrared image and preset reference infrared image
Fruit;
Determining module 44, for being according to second comparing result and multiple continuously first comparing result, determinations
It is no that there are fire.
Further, module 41 is obtained, for obtaining depth image and infrared figure in real time based on the TOF depth mould group
Picture;Wherein, the depth image and the infrared image are obtained in same frame.
Further, the first contrast module 42 obtains the first depth block image for dividing the depth image;
Mark each depth block index number in the first depth block image;
The preset reference depth image is divided, the first reference depth block image is obtained;
Mark each depth block index number in the first reference depth block image;
According to the depth block index number, the first depth block image and the first reference depth piecemeal are compared
The piecemeal in image;
Obtain the first comparing result.
Further, the of the corresponding piecemeal of each depth block index number in the first depth block image is obtained
One gray average;
Obtain the first ginseng of the corresponding piecemeal of each depth block index number in the first reference depth block image
Examine gray average;
According to the depth block index number, successively first gray average and corresponding described first is with reference to ash
Spend the depth gray scale difference value between mean value.
Further, it according to the first preset threshold, is compared with the depth gray scale difference value;
If the depth gray scale difference value is greater than first preset threshold, the corresponding depth block index is obtained
Number, obtain the first comparing result.
Second contrast module 43 divides the infrared image, obtains the first infrared block image;
Mark each infrared block index number in the described first infrared block image;
The preset reference infrared image is divided, first is obtained and refers to infrared block image;
Mark each infrared block index number in the infrared block image of first reference;
According to the infrared block index number, compares the first infrared block image and described first and refer to infrared piecemeal
The piecemeal in image;
Obtain the second comparing result.
Further, the of the corresponding piecemeal of each infrared block index number in the first infrared block image is obtained
One infrared gray average;
Obtain described first the first ginseng with reference to the corresponding piecemeal of the infrared block index number each in infrared block image
Examine infrared gray average;
According to the infrared block index number, successively the more described first infrared gray average and corresponding described first is joined
Examine the infrared gray scale difference value between infrared gray average.
Further, it according to the second preset threshold, is compared with the infrared gray scale difference value;
If the infrared gray scale difference value is greater than second preset threshold, the corresponding infrared block index is obtained
Number, obtain the second comparing result.
Further, for judging whether fire occurs for the determining module 44, if multiple continuous first comparison knots
Fruit and second comparing result are and the depth block index number and the infrared block index number there are fire
It is corresponding, it is determined that there are fire.
Further, however, it is determined that there are fire, according to set spatial position and the depth image and/or the infrared figure
Corresponding relationship as between determines the spatial position that fire occurs.
Based on the above embodiment, by depth module and infrared module, while depth image and infrared image being obtained.It will be real
The depth image and infrared image of acquisition are applied, carries out gray scale with the reference depth image and reference ir image obtained before this respectively
The comparison of value.If infrared gray scale difference value and gray scale difference value all meet corresponding preset difference value, then it is assumed that fire has occurred.It needs
It is bright, when carrying out gray value comparison, generally require for image to be split for multiple piecemeals, and based on being averaged in piecemeal
Gray value compares.After fire occurs for confirmation, staff is notified in time.By by the corresponding depth gray scale of depth image
Difference and the corresponding infrared gray scale difference value of infrared image compare, and finally determine whether that fire occurs, and further can be with
The position that fire occurs is determined based on image, can fast and accurately determine whether that fire occurs, and can mention for staff
Accurate location information and corresponding image information for generation fire.
Based on same thinking, the embodiment of the present invention also provides a kind of electronic equipment, comprising: memory, processor;Its
In,
The memory is for storing one or more computer instruction, wherein one or more computer instruction
Following method is realized when being executed by the processor:
Depth image and infrared image are obtained by TOF depth mould group;
The depth image and preset reference depth image are compared, the first comparing result is obtained;
The infrared image and preset reference infrared image are compared, the second comparing result is obtained;
According to second comparing result and multiple continuous first comparing results, it is determined whether there are fire.
The apparatus embodiments described above are merely exemplary, wherein described, unit can as illustrated by the separation member
It is physically separated with being or may not be, component shown as a unit may or may not be physics list
Member, it can it is in one place, or may be distributed over multiple network units.It can be selected according to the actual needs
In some or all of the modules achieve the purpose of the solution of this embodiment.Those of ordinary skill in the art are not paying creativeness
Labour in the case where, it can understand and implement.
Through the above description of the embodiments, those skilled in the art can be understood that each embodiment can
It is realized by the mode of required general hardware platform is added, naturally it is also possible to which reality is come in conjunction with by way of hardware and software
It is existing.Based on this understanding, substantially the part that contributes to existing technology can be to calculate in other words for above-mentioned technical proposal
The form of machine product embodies, and it wherein includes the meter of computer usable program code that the present invention, which can be used in one or more,
The computer journey implemented in calculation machine usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
The form of sequence product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions
The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs
General purpose computer, special purpose computer, Embedded Processor or other programmable coordinates are instructed to determine the processor of equipment to produce
A raw machine, so that being generated by the instruction that computer or other programmable coordinates determine that the processor of equipment executes for real
The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable coordinates determine equipment with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions can also be loaded into computer or other programmable coordinates determine in equipment, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net
Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although
Present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: it still may be used
To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features;
And these are modified or replaceed, technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution spirit and
Range.