如何使用Emgu检测物体的方向和数量? [英] How can I detect direction and number of objects using Emgu?
问题描述
如何使用Emgu检测物体的方向和数量?
How can I detect direction and number of objects using Emgu?
物体向各个方向移动(2D);并且相机正在看到这些物体(在2D表面上).物体的形状可能几乎没有差异,但足够相似.
Objects are moving in all directions (2D); and a camera is seeing these objects (on a 2D surface). Object may have little differences in shape but are similar enough.
谢谢
推荐答案
- 在连续的帧(可能在每个
n
和(n - gap)
帧上)调用cvAbsDiff
来检测变化并使用阈值以获得变化掩码 - 对于每个框架调用
cvUpdateMotionHistory
,并将获得的掩码作为参数传递 - 要获取运动段(对象)及其方向,请执行以下操作:
- Invoke
cvAbsDiff
on successive frames (may be on eachn
-th and(n - gap)
-th frame) to detect changes and use thresholding in order to get a changes mask - For each frame call
cvUpdateMotionHistory
and pass obtained mask as an argument - To get motion segments (objects) and their orientation:
- 通话
cvCalcMotionGradient
传递以前通话累积的运动历史记录 - 通过
cvSegmentMotion
将运动拆分为多个段,并使用cvCalcGlobalOrientation
为每个段计算角度
- call
cvCalcMotionGradient
passing motion history accumulated by previous calls - Split motion into segments by
cvSegmentMotion
and for each segment calculate angle usingcvCalcGlobalOrientation
类似的步骤在OpenCV库中分发的motempl.c
示例中进行了编码.
Similar steps are coded in motempl.c
example distributed within OpenCV library.
更新
我认为他们已经实现了几乎完整的OpenCV绑定,并且接口的差异是添加OOP的结果.例如,这是一个 AbsDiff 方法.然而,与运动有关的东西具有不同的结构.使用MotionInfo
方法获取运动角度,如下面的示例(我发现使用Google搜索).
I thought that they've implemented almost complete OpenCV binding and differencies in interface are the result of adding OOP. For instance here is an AbsDiff method. However motion related stuff has different structure. Use MotionInfo
method to get motion angle as in this example (which I found with google search).
这篇关于如何使用Emgu检测物体的方向和数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!