【问题标题】:Image processing - tracking blobs of different colours图像处理 - 跟踪不同颜色的斑点
【发布时间】:2013-11-11 17:50:00
【问题描述】:

我正在努力寻找在纯色背景上跟踪不同颜色对象的最佳方法。

我已经阅读过,似乎区分颜色的最佳方法是首先将图像转换为 HSV 空间,然后基于色调进行阈值。但是,由于我不仅在跟踪一个对象,而且不知道用哪些值对其进行阈值,因此哪种方法最好找到这些对象的颜色?直方图方法是否有效,我忽略峰值,因为背景占据了大部分像素,然后其余的峰值代表不同的颜色?

找到不同的颜色后,我可以对图像进行阈值处理,然后找到轮廓,从而勾勒出物体的轮廓。

有没有比我建议的方法更好的方法来跟踪 blob?

我还查看了诸如 cvBlob 之类的库,但是我在尝试安装这些库时遇到了麻烦,所以我宁愿坚持使用纯 OpenCV 实现。

附带说明,我使用的是 C++ OpenCV 库。

【问题讨论】:

  • 每个对象都有不同的颜色,还是什么?如果您有一个颜色项目,则无需机器学习或类似的东西。
  • 你能上传一些示例图片吗?

标签: c++ opencv image-processing


【解决方案1】:

您需要问自己以下几个问题。您的问题表明您需要一个相当简单的跟踪算法。你看过哪些方法? opencv 库是一个伟大的入门场所。您是否尝试过阅读教程(即http://opencv-srf.blogspot.ro/2010/09/object-detection-using-color-seperation.html)这些将成为您构建越来越复杂算法的垫脚石。

  • 您是否需要处理遮挡(当一个对象出现在另一个对象前面时?
  • 您的背景是多么简单 - 它是否发生了变化。如果它没有改变,事情就会变得容易得多。
  • 对象可以自发出现在图像帧的中间还是必须从侧面出现
  • 物体在框架中移动时颜色会发生变化吗?
  • 这是 2D 还是 3D 跟踪问题?

一般来说,跟踪问题通常根据对上述问题和许多其他问题的回答分为两部分:

  1. 对象检测(当前帧)
  2. 对象关联(来自上一帧)

这里最简单的假设是伪代码实现。请注意,还有许多其他方法可以做到这一点。密集特征跟踪、稀疏特征、基于直方图、运动

#object detection (relatively easy part)
Read b = Background Image (this image needs to be read before any objects are in the scene - it can be thought of as initialization stage)
Read c = Current Image
diff = c - b > Threshold
#everywhere there is a difference indicates a part of an object
#now abstract to higher level objects based on connected components.  During occlusions you'll need to differentiate based on color, and maybe even motion if two objects are similar color
#Object association (relatively harder part)
For every object check if this object is already in your list (you'll need a distance metric here to check how similar this object is to another - based on histogram difference, feature points, motion etc...)
If in list, then add this information to the object's track
If in list, you want to consider if you need to update the object model based on the new information.  Did the object change shape/color/motion?
If not in list add it

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-02
    • 2014-02-08
    • 2020-09-12
    • 2018-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-27
    相关资源
    最近更新 更多