Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

Fire detection using opencv

asked 2016-01-26 05:39:57 -0500

Red Viper gravatar image

updated 2016-01-27 05:05:53 -0500

I have read a comment here to using cascade classifier but isn't cascade classifier only good for rigid objects?

edit retag flag offensive close merge delete



I would try a NIR enhanced camera (>800nm) with a NIR band pass filter on Lens.

pklab gravatar imagepklab ( 2016-01-26 05:57:55 -0500 )edit

so cascade classifier with NIR enhanced camera? no chance of detecting it using low cam like webcam?

Red Viper gravatar imageRed Viper ( 2016-01-26 06:02:48 -0500 )edit

I would do it in Steven's way. You should do a colour segmentation and try to interpret the information in those areas... You should keep in mind that flames may change colour depending on the burning materials or gases.

thdrksdfthmn gravatar imagethdrksdfthmn ( 2016-01-26 06:31:58 -0500 )edit

is there any other way that uses machine learning?

Red Viper gravatar imageRed Viper ( 2016-01-26 06:49:07 -0500 )edit

Maybe BoW can help to detect if there is fire in the interesting regions in the picture (applying it on the blobs from bg subtraction). But why it's necessary to use ml?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2016-01-26 07:15:29 -0500 )edit

Its an assignment given to us and im confused what concept to apply

Red Viper gravatar imageRed Viper ( 2016-01-26 07:36:13 -0500 )edit

Ok, so I think this is a good start: bg subtraction is good for detecting the regions of interest and training and applying the BOW on them can predict if the ROIs contain fire or not

thdrksdfthmn gravatar imagethdrksdfthmn ( 2016-01-26 07:47:19 -0500 )edit

many webcams have sensor sensible over 800nm but have an embedded IR cut filter. You can find a lot of instruction on how to remove this filter from cheaper webcams. To enhance IR region you would install a visible light stop filter so you would see only flames as white :). As assignment it could works but it's just an idea

pklab gravatar imagepklab ( 2016-01-26 08:03:09 -0500 )edit

I don't understand why you need NIR enhanced camera. Can you explain or give a reference?

LBerger gravatar imageLBerger ( 2016-01-26 09:35:54 -0500 )edit

Yes, there is no remark about NIR in the question...

thdrksdfthmn gravatar imagethdrksdfthmn ( 2016-01-26 09:54:31 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2016-01-27 04:07:11 -0500

pklab gravatar image

I'm posting some images from a simple test. 2 webcams looks at same scene: a flame from a common lighter.

image description

image description

On the left, an image from a Webcam where the IR cut filter (piece of glass on the sensor) has been removed and a visible cut filter (a piece of enveloped photo negative in front of lens) has been installed. On the right, same scene from standard laptop webcam.

The result is same also if the flame is far from the cam.

I think this example is explicative :)

You can search the Internet by "remove IR cut filter webcam" or, if you like raspberrypi, to buy a pi-noir-camera

Solution isn't always only in the algorithms even if to modify the environment is not always feasible and sure isn't a machine learning approach.

enjoy with experiments ;)

edit flag offensive delete link more


replacing the "cut-off-ir" filter (a piece of coated glass between sensor and lens) with a piece of an old floppy disc as an "cut-off-visible-light" filter does wonders here ...

berak gravatar imageberak ( 2016-01-27 04:14:53 -0500 )edit

Nice experiment. Can you decrease gain in standard lapto gain?

LBerger gravatar imageLBerger ( 2016-01-27 04:27:56 -0500 )edit

@LBerger both gain and gamma are at minimum

pklab gravatar imagepklab ( 2016-01-27 04:37:22 -0500 )edit

Thank you for this never thought about background being able to block the flame from the view, although I'm still looking for a way to detect fire using Machine learning in opencv

Red Viper gravatar imageRed Viper ( 2016-01-27 04:53:19 -0500 )edit

The example shows that in the visible spectrum, the flame visibility depend on context. In the IR, the context is less relevant. After this you could use ML on IR image too.

pklab gravatar imagepklab ( 2016-01-27 05:23:36 -0500 )edit

I see, after having IR do you have suggestion for what ML to use. or any ML will work?

Red Viper gravatar imageRed Viper ( 2016-01-27 05:37:02 -0500 )edit

I must say that I'm very surprise by this result.If "flame" is at 900K and wall at 3000K contrast enhancement is about 20 using band 800-1000nm instead of 400-800nm. You lost about 50% of light

LBerger gravatar imageLBerger ( 2016-01-27 07:39:36 -0500 )edit

I don't understand why the wall is at 3000K, south Italy is warm but not more 320K :) In your equation you take the wall as a black body but isn't. It emits energy due to reflection and transmission + a small part of emission because of it's temperature. Not only, emissivity changes with wavelength. Your nice equations should consider this too.

Objects reflects and transmits visible lights but we cut this with filter. In 800..1000nm the reflected light decrease close to zero and we start to see only energy from temperature. This case is similar to a black body. The temperature of the wall is really lower compared to the flame. Because the emitted energy is proportional to the temperature the flame looks brighter than the wall.

Maybe I'm wrong and sure Viper want to know about ML.

pklab gravatar imagepklab ( 2016-01-27 12:59:06 -0500 )edit

Yes wall is not 3000K but light temperature is about 3000k. Light comming from wall is not due black body but due to sun reflection and diffusion (I hope that transmitivity in visble light is 0). If you want to see light comming from wall you should use a thermal infrared camera which can see light ranging from 9 to 14um (wall temperature about 320K).

Now I vote for your post because you are right and even with your answer I had got a doubt about contrast enhancement that's why I have made some computation using equation. That's not my nice equation it's only planck equation and ccd spectral response is included in computation too

LBerger gravatar imageLBerger ( 2016-01-27 15:11:17 -0500 )edit

answered 2016-02-09 05:12:45 -0500

Based on comment from this question, and coments from the other related question (Fire/Flame Detection using OpenCV):

@StevenPuttemans: "Another way could be to use the fact that fire actually involves motion between frames in a video input"

@Guanta "You could train a cascade-classifier with LBPs since LBPs are also often used for texture detection/recognition this would be worth trying"

"is there any other way that uses machine learning?"

@pklab "The example shows that in the visible spectrum, the flame visibility depend on context. In the IR, the context is less relevant. After this you could use ML on IR image too."

I would like to complete the proposed hardware answer with a software one that i think could work together.

In this paper: "Early Fire Detection Using HEP and Space-time Analysis" [1] motion (as suggested by @stevenputtemans) and texture analysis (as suggested by @guanta) are involved.

You could also check "Video Fire Detection - Review" [2], Real-time Fire Detection for Video Surveillance Applications using a Combination of Experts based on Color, Shape and Motion [3], Automatic fire pixel detection using image processing: A comparative analysis of Rule-based and Machine Learning-based methods [4]





edit flag offensive delete link more



@albertofernandez really usefull bib reference. Thank you !

pklab gravatar imagepklab ( 2016-02-09 05:53:50 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2016-01-26 05:39:57 -0500

Seen: 5,487 times

Last updated: Feb 09 '16