如何创建 Haar Cascade(.xml 文件)以在 OpenCV 中使用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2000816/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create Haar Cascade (.xml file) to use in OpenCV?
提问by Alexander Logger
If you are familiar with OpenCV library, you know what Haar Cascade image object detection is. By image object detection I mean, like human face detection or something else. I have some Haar Cascade XMLs for face detection, but I don't know how to create my own. I want to create Haar Cascade XMLs to detect simple bright circle light sources (i.e. flashing infrared light from TV remote control).
如果您熟悉 OpenCV 库,您就会知道 Haar Cascade 图像对象检测是什么。我的意思是图像对象检测,比如人脸检测或其他东西。我有一些用于人脸检测的 Haar Cascade XML,但我不知道如何创建自己的。我想创建 Haar Cascade XMLs 来检测简单的明亮圆形光源(即来自电视遥控器的闪烁红外光)。
So, how do I create a Haar Cascade (.xml file) to use in OpenCV?
那么,如何创建一个 Haar Cascade(.xml 文件)以在 OpenCV 中使用?
采纳答案by Tony The Lion
回答by Scott
回答by Sublime
If you are interested to detect simple IR light blob through haar cascade, it will be very odd to do. Because simple IR blob does not have enough features to be trained through opencv like other objects (face, eyes,nose etc). Because IR is just a simple light having only one feature of brightness in my point of view. But if you want to learn how to train a classifier following link will help you alot.
如果您有兴趣通过 haar 级联检测简单的 IR 光团,这样做会很奇怪。因为简单的 IR blob 没有足够的特征可以像其他对象(脸、眼睛、鼻子等)一样通过 opencv 进行训练。因为在我看来,IR 只是一种简单的光,只有一个亮度特征。但是如果你想学习如何训练分类器,下面的链接会对你有很大帮助。
http://note.sonots.com/SciSoftware/haartraining.html
http://note.sonots.com/SciSoftware/haartraining.html
And if you just want to detect IR blob, then you have two more possibilities, one is you go for DIP algorithms to detect bright region and the other one which I recommend you is you can use an IR cam which just pass the IR blob and you can detect easily the IR blob by using opencv blob functiuons. If you think an IR cam is expansive, you can make simple webcam to an IR cam by removing IR blocker (if any) and add visible light blocker i.e negative film, floppy material or any other. You can check the following link to convert simple webcam to IR cam.
如果您只想检测 IR blob,那么您还有两种可能性,一种是使用 DIP 算法来检测明亮区域,另一种是我建议您可以使用仅通过 IR blob 的 IR cam 和您可以使用 opencv blob 函数轻松检测 IR blob。如果您认为 IR 摄像头很庞大,您可以通过移除 IR 阻挡器(如果有)并添加可见光阻挡器(即负片、软盘材料或任何其他材料)来将简单的网络摄像头制作为 IR 摄像头。您可以查看以下链接将简单的网络摄像头转换为红外摄像头。
http://www.metacafe.com/watch/385098/transform_your_webcam_into_an_infrared_cam/
http://www.metacafe.com/watch/385098/transform_your_webcam_into_an_infrared_cam/

