视频中的火灾/烟雾检测 [英] fire/smoke detection in video

查看:233
本文介绍了视频中的火灾/烟雾检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个项目,要求我使用C#来检测视频中的火灾和烟雾.
现在,我才刚刚开始尝试检测视频中的红色和发光.

如果有人可以帮忙,我也有兴趣探索凹凸贴图矩阵事物.

我也建议使用AForge.NET框架.我有0个知识.

请帮助:confused:

Hi,

I''ve got a project that requires me to use C# to detect fire and smoke in a video.
For now I am just starting to try and detect red and glow in a video.

I''m also interested in exploring the bump map matrix thing, if anyone can help.

I''m also recommended to use AForge.NET framework. Which I have 0 knowledge in.

please help :confused:

推荐答案

我发现您的处理程序videoSourcePlayer_NewFrame从未被调用.反过来,这是因为从未调用Initializevideo.我只是从表单的构造函数中调用了Initializevideo(是否适合只调用一次,还是需要一次又一次地在每个流上调用它?(我不这么认为)),现在触发NewFrame事件,并调用您的处理程序.我看不到任何视觉效果,但是现在这是您的问题.该错误已找到.

这很容易找到,但是代码却很难阅读.这是该错误的唯一原因-您仅由于一些(较小)混乱而损害了控制和视觉.您需要执行一些步骤:

1.停止执行Microsoft建议的全设计时方式-这仅适用于出色的演示和播放器.我的意思是,只需删除所有自动生成的代码设置事件.用手动代码在一个地方完成(请参阅下面的一些建议).使用清晰的lambda语法:

I found that your handler videoSourcePlayer_NewFrame is never called. In turn, this is because Initializevideo is never called. I simply called Initializevideo from the form''s constructor (is it appropriate to call it just once, or you need to call it on every stream again and again? (I don''t think so)), and now the NewFrame event is fired and your handler is called. I don''t see any visual effects, but now this is your problem. The bug is found.

That was easy to find, but the code is hard to read. This is the only reason for the bug -- you have compromised control and vision just because of some (minor) mess. You need to do some steps:

1. Stop doing Microsoft suggested all-design-time way -- it''s just for cool demos and lamers. I mean, simply remove all auto-generated codes setting events. Do it in manual code in one place (see some suggestion below). Use clear lambda syntax:

MyComponent.MyEvent += (sender, eventArgs) => {
/* some handler code here:
   using sender or not,
   using eventArgs or not...
*/
}



2.请为该表单创建另一个源文件(类为partial,因此您可以根据需要拥有尽可能多的文件).

3.请将您自己的代码与自动生成的UI以及逻辑与UI分开(也许为该表单创建另一个源文件:您将拥有3个文件:1)您自己的UI方面,2)您自己的视频方面,3)Microsoft自动生成的东西(已经存在)

4.在属性"节点上,删除除AssemblyInfo.cs以外的所有内容,直到您真正使用此废话为止(很有可能-您将永远不会使用它们;资源在单独的Resources目录中会更好;您会随时创建它们). >
5.创建一个单一的方法将所有事件设置在一个位置(可能是两个,分别是(c)和SetupVideoEvents,如(1)所示).从表单构造函数调用这两个方法,最终会更好.

6.切勿提交.\bin .\obj *.suo(以及*.user等).您需要确切地知道哪些文件属于源.

而已.这种布局可能是:1)不够完美; 2)我自己的风格过多;没关系,还是比你更好;随着时间的流逝,您将使其更贴近您的口味.我的意思是,您可以选择不按这种方式进行排序,但是请考虑以下问题:我只花了几秒钟的时间来发现错误,但是...要花多长时间?好吧,浪费了太多的时间来回顾什么是什么.下次可能要打扰我太多了.

当我准确回答您的问题时,我认为您应该接受此答案.好的投票也不会伤害.



2. Please create another source file for the form (the class is partial, so you can have as many as you want).

3. Please separate your own code from auto-generated, moreover, UI from logics (maybe create another source file for the form: you will have 3 files: 1) your own UI aspects, 2) your own video aspects, 3) Microsoft auto-generated stuff (which is already there)

4. From Properties node, remove everything except AssemblyInfo.cs until you actually use this crap (good chances are -- you will never use them; resources are better in separate Resources directory; you will create them at any moment).

5. Create one single method to setup all events in one place (maybe, two: SetupUiEvents and SetupVideoEvents in syntax shown in (1)). Call both methods from the form constructors, better at the very end.

6. You should never submit .\bin .\obj *.suo, (also *.user, etc.). You need to know exactly what files belong to the source.

That''s it. This layout maybe 1) not perfect, 2) too much of my own style; no matter, still better then yours; with time, you''ll improve it closer to your taste. I mean, you may choose not to do put things in order in this way, but consider this: I spent only few seconds to discover the bug, but... how long? well, wasted too much time to review where is what. Next time it may bother me too much to take care.

As I answered your question precisely, I think you should accept this answer. A good vote will not hurt either.


安德鲁·基里洛夫(Andrew Kirillov), http://www.codeproject.com/script/Membership/View.aspx?mid=1181072 [
Andrew Kirillov的相关文章
运动检测算法 [
Andrew Kirillov, http://www.codeproject.com/script/Membership/View.aspx?mid=1181072[^] is the author of AForge.NET and is a very knowledgeable person; he would be able to give the most help.

A have a naive idea about smoke detection. You can evaluate global level of contrast in the picture. The smoke will degrade contrast very well. The sample (no-smoke) contrast level should be re-taken from time to time. Unfortunately, it cannot tell smoke from fog :<.

If you think the flame is always red, you''re wrong.

Also, the flame will be much more visible and detectable in infra-red, not visible part of spectrum. Practically, fire will look as "a lot of light" versus "almost no light" if you totally block visible light and see only near infra-red; I know for sure.

Related article by Andrew Kirillov
Motion Detection Algorithms[^]


这篇关于视频中的火灾/烟雾检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆