简体   繁体   English

使用Open CV跟踪对象

[英]Object Tracking Using Open CV

I am planning to do a project which involves tracking various kinds of objects (including people, vehicles, etc) from the video input of a CCTV camera. 我计划做一个项目,该项目涉及从CCTV摄像机的视频输入中跟踪各种对象(包括人,车辆等)。 I am intending to use OpenCV. 我打算使用OpenCV。 The implementation should be tolerant to occlusion and should be able to recognize and continue tracking objects even if they exit the frame and re-enter after a while. 该实现应该能够容忍遮挡,并且应该能够识别并继续跟踪对象,即使它们退出框架并在一段时间后重新进入也是如此。 Also new entries into the frame should be identified automatically and tracked and I need to extract the positions of the objects over time. 另外,应该自动识别并跟踪框架中的新条目,并且我需要随着时间的推移提取对象的位置。 Since there are a lot of options available, I am actually confused. 既然有很多可用的选项,我实际上很困惑。 Can somebody suggest the best way forward. 有人可以建议最好的方法。 I have already tried the following: 我已经尝试了以下方法:

  • I tried using the Tracking API of Open CV and tried out all of the following algorithms: MIL, TLD, BOOSTING, MEDIANFLOW. 我尝试使用Open CV的Tracking API,并尝试了以下所有算法:MIL,TLD,BOOSTING,MEDIANFLOW。 But none of them seem to be accurate enough. 但是它们似乎都不足够准确。
  • I also know about the Kalman Filter. 我也知道卡尔曼滤波器。 But it cannot handle the problem of recognizing a previous object that has re-entered the frame from a different position. 但是它不能解决识别从不同位置重新进入框架的先前物体的问题。 I would prefer a solution that incorporates this feature too. 我也希望有一个包含此功能的解决方案。
  • I tried out Camshift. 我尝试了Camshift。 But it requires specification of intensity ranges. 但这需要规范强度范围。 Since the actual setup of the CCTV installation is not known before-hand, this is not an option either. 由于事先不知道CCTV安装的实际设置,因此也不是一种选择。
  • I also looked up the HOGDescriptor class. 我还查询了HOGDescriptor类。 But it does not provide a facility for tracking directly right? 但是它没有提供直接跟踪的功能吗? I mean only detection is performed. 我的意思是只执行检测。

Are there better solutions that are more suitable to the problem at hand than the ones mentioned above? 是否有比上述解决方案更适合解决当前问题的解决方案? Are there any ways to improve the accuracy of the Tracking algorithms? 有什么方法可以提高跟踪算法的准确性? And are there ways to improve on the solutions that I have already considered? 是否有方法可以改善我已经考虑过的解决方案? Please help to solve my confusion. 请帮助解决我的困惑。

You are basically looking for the perfect tracking algorithm :) If you want to know which fits best for your requirements, you can check the benchmarks such as Visual Object Tracking Challenge , Visual Tracker Benchmark . 基本上,您正在寻找一种完美的跟踪算法:)如果您想知道哪种最适合您的需求,则可以查看诸如Visual Object Tracking ChallengeVisual Tracker Benchmark之类的基准测试 It may be tough to implement though. 不过可能很难实施。

On the other hand, I guess that you want real time performance. 另一方面,我想您需要实时性能。 In this case, you should check my this answer, too. 在这种情况下,你应该检查我的这个答案了。

I also know about the Kalman Filter. 我也知道卡尔曼滤波器。 But it cannot handle the problem of recognizing a previous object that has re-entered the frame from a different position. 但是它不能解决识别从不同位置重新进入框架的先前物体的问题。 I would prefer a solution that incorporates this feature too. 我也希望有一个包含此功能的解决方案。

There is no such prediction algorithm. 没有这样的预测算法。 You have to check every possible border position to locate the target again. 您必须检查所有可能的边界位置才能再次定位目标。

I tried out Camshift. 我尝试了Camshift。 But it requires specification of intensity ranges. 但这需要规范强度范围。 Since the actual setup of the CCTV installation is not known before-hand, this is not an option either. 由于事先不知道CCTV安装的实际设置,因此也不是一种选择。

Since you practically want the best algorithm ever, probably you wouldn't prefer camshift. 由于您实际上想要有史以来最好的算法,因此您可能不希望使用camshift。 A histogram based algorithm is not robust to similar targets (or any object with similar colors, there are some algorithms which is histogram based and try to deal with shapes ( fragTrack is a good example). Yet, i think it won't satisfy you.) 基于直方图的算法对相似的目标(或任何具有相似颜色的对象)并不健壮,有些算法基于直方图并尝试处理形状( fragTrack是一个很好的例子)。但是,我认为它不能满足您的要求。)

I also looked up the HOGDescriptor class. 我还查询了HOGDescriptor类。 But it does not provide a facility for tracking directly right? 但是它没有提供直接跟踪的功能吗? I mean only detection is performed. 我的意思是只执行检测。

Practically, to detect a target you need to train it first (or (for example) you could use an objectness algorithm to detect salient objects in the scene). 实际上,要检测目标,您需要首先对其进行训练(或者(例如,您可以使用客观算法来检测场景中的显着对象))。 Which means you have to train it for every possible target. 这意味着您必须针对每个可能的目标进行训练。 So, if you detect one of the targets trained before, you could try to detect the same target in every frame. 因此,如果您检测到之前训练的目标之一,则可以尝试在每个帧中检测相同的目标。 You could use a Kalman filter to narrow down the search gate and get better results. 您可以使用卡尔曼滤波器来缩小搜索范围并获得更好的结果。

To sum up, start with benchmarks. 综上所述,从基准开始。 Find the best algorithm that fits for you. 找到适合您的最佳算法。

By the way, deep learning is the trend for computer vision algorithms nowadays. 顺便说一下, 深度学习是当今计算机视觉算法的趋势。 Probably the best one comprises deep learning one way or another. 最好的方法可能包括以一种或另一种方式进行深度学习。

Hope this helps, 希望这可以帮助,
Gokhan. 格克汗。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM