使用类似 haar 的特征在 Flash 中进行物体检测

发布于 2024-12-12 06:56:01 字数 787 浏览 5 评论 0原文

在OpenCV中,我们可以使用xml文件来描述特定对象的类似haar的特征。我想要 使用这个想法来检测手掌和拳头,现在我有自己的xml特征文件,并且效果很好 在C和Python(使用OpenCV)中,现在我需要将这个想法转移到flash中。

幸运的是,我发现了一个名为 Marilena 的项目,它成功地将 haar-trainning 部分移至OpenCV 到 actionscript,本文 优化基于 flash 的人脸检测优化了Marilena,他将xml文件转换成actionscript类本身以加速计算。然而,由于 Haar 数据现在被硬编码到类中,因此它无法用于跟踪除面部之外的任何其他内容。我尝试详细阅读源代码,并按照他的方式将自己的xml文件处理成actionscript类文件,但最终发现了一些不同的东西。

用于人脸检测的 xml 文件如下:

在此处输入图像描述

每棵树只有一个节点“根节点”,但在我的xml文件,有些树有两个节点,上面的“left_val”有时会变成“left_node”,我不知道如何处理这些节点。我想我应该去 OpenCV C 源文件了解详细信息,以找到如何正确处理 xml 特征文件,但是从哪里开始,有一些建议吗?

In OpenCV, we can use a xml file to describe haar-like features of a specific object. I wanna
use this idea to detect palm and fist, now I hava my own xml feature file, and it works well
in C and Python(with OpenCV), now I need to move this idea to flash.

Luckily, I found an project named Marilena, it successfully moved the haar-trainning part of OpenCV to actionscript, and this article optimizing flash based face detection optimized Marilena, he turned the xml file into actionscript class itself to speedup the calculation. However, since the Haar data is being hardcoded into the class now it will not be able to use for tracking anything else but faces. I try to read the source code for detail, and process my own xml file into actionscript class file in his way, but finally find something different.

The xml file for face detection is like :

enter image description here

Every tree has only one node "root node", but in my xml file, some trees have two nodes, and the "left_val" above changes to "left_node" sometime, I don't know how to process these nodes. I think I should goto OpenCV C source files for detail to find how to correctly process xml feature file, but where to start, some advices?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少钕鈤記 2024-12-19 06:56:02

我建议阅读 Actionscript 中的 E4X 和用于算法目的的二叉树

因此,如果您在解析 xml 数据时能够区分 left_val 和 left_nodes(它们看起来像分支(在您的情况下为节点)和叶子),那么您就走在正确的道路上了。正如您可以猜测的那样,当叶子是节点时,它将分支成更多叶子,因此基本上所有东西都是叶子,但可以具有特殊含义,例如保留/授予对更多叶子的访问权限。我确信这篇文章会更有意义,但我只是想总结一下。

您可能还想了解一下递归函数,因为您可能需要一个自循环函数来遍历叶子。这是维基百科: http://en.wikipedia.org/wiki/Recursion_(computer_science< /a>) 斐波那契数就是一个很好的例子,您还可以在同一篇文章中找到二分搜索,希望这能满足您的需求

I'd suggest reading on E4X in Actionscript and binary trees for algorithm purposes.

So, if you can distinguish left_val and left_nodes which seem like branches (nodes in your cases) and leaves when you are parsing your xml data, you're on the right path. As you can guess, when a leaf is a node, that will branch into more leaves so basically everything is leaves but can have special meaning like holding/giving access to more leaves. I'm sure the article will make more sense but I just wanted to summarize it.

You might also want to take a look at recursive functions because you may need a self looping function to run through the leaves. Here is the wiki for that : http://en.wikipedia.org/wiki/Recursion_(computer_science) Fibonacci numbers is a good example for this and you can also find binary search in the same article which will hopefully be all you need.

Have fun.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文