How can I detect direction and number of objects using Emgu?

本小妞迷上赌 提交于 2019-12-23 02:28:11

问题


How can I detect direction and number of objects using Emgu?

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.

Thanks


回答1:


  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. call cvCalcMotionGradient passing motion history accumulated by previous calls
    2. Split motion into segments by cvSegmentMotion and for each segment calculate angle using cvCalcGlobalOrientation

Similar steps are coded in motempl.c example distributed within OpenCV library.

Update

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).



来源:https://stackoverflow.com/questions/5880311/how-can-i-detect-direction-and-number-of-objects-using-emgu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!