如何使用Emgu检测物体的方向和数量? [英] How can I detect direction and number of objects using Emgu?

查看:97
本文介绍了如何使用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.

谢谢

推荐答案

  1. 在连续的帧(可能在每个n(n - gap)帧上)调用cvAbsDiff来检测变化并使用阈值以获得变化掩码
  2. 对于每个框架调用cvUpdateMotionHistory,并将获得的掩码作为参数传递
  3. 要获取运动段(对象)及其方向,请执行以下操作:
  1. Invoke cvAbsDiff on successive frames (may be on each n-th and (n - gap)-th frame) to detect changes and use thresholding in order to get a changes mask
  2. For each frame call cvUpdateMotionHistory and pass obtained mask as an argument
  3. To get motion segments (objects) and their orientation:
  1. 通话cvCalcMotionGradient传递以前通话累积的运动历史记录
  2. 通过cvSegmentMotion将运动拆分为多个段,并使用cvCalcGlobalOrientation
  3. 为每个段计算角度
  1. call cvCalcMotionGradient passing motion history accumulated by previous calls
  2. Split motion into segments by cvSegmentMotion and for each segment calculate angle using cvCalcGlobalOrientation

类似的步骤在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屋!

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