使用OpenCV跟踪对象 [英] Tracking an object with OpenCV

查看:108
本文介绍了使用OpenCV跟踪对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用OpenCV作为机器人的一部分来实现对单个对象的跟踪,该跟踪器跟踪在框架中以矩形区域标记的对象.根据框架中定义的模板,机器人必须追逐该对象.对象不能是单一颜色,并且对象的方向也会改变.机器人捕获的视频由笔记本电脑处理,并作为处理结果将移动命令发送给机器人.

I am trying to implement tracking of a single object with OpenCV as a part of a robot, that tracks an object which is marked by a rectangular region in a frame. Based on that template defined in a frame, the robot must chase that object. The object cannot be of a single color and also the orientation of the object changes. The video captured by the robot is processed by a laptop and commands for the movement is send to the robot as a result of processing.

我对OpenCV很陌生.阅读了有关运动跟踪的内容后,我发现通过动态更新模板,使用Lucas-Kanade方法的光流适合于此目的.

I am pretty new to OpenCV. After reading something about motion tracking, i found optical flow with Lucas-Kanade Method suits for this purpose by dynamically updating the template.

此方法足以满足我的要求吗? 使用这种方法是否可以实现实时处理? 我还想知道是否有其他方法最适合我的目的?

Is this method enough for my requirements? Is it possible to achieve realtime processing using this method ? I also want to know whether any other method(s) best suits my purpose ?

如果我错了,请纠正我.

Please correct me if i am wrong.

推荐答案

跟踪是一个被广泛研究的主题,并且没有标准的(并且通常没有健壮的)解决方案.相当健壮的跟踪代码主要由博士生编写多年.

Tracking is a widely researched topic and there is no standard (and no generally robust) solution. Fairly robust tracking code are written for years mostly by PhD students.

如果允许您使用其他人的代码,请在youtube中输入:

If you are allowed to use someone else's code, type in youtube: Predator: Camera That Learns. It is a fairly generic fast tracking algorithm (under the hood it is a feature-based advanced Haar-like tree/cascade classifier). There, in the video you can find references to research papers and if you google-up the inventor guy Zdanek's old university homepage you can download and use his code.

如果必须编写自己的代码,则可以采用一些非常简单的系统.如果您跟踪的对象变化不大且移动不剧烈,建议您使用模板匹配.一旦检测到的模板与原始模板有所不同,您可以使用最近的检测来更新模板.这会导致漂移.如果偏移太大,则可以返回到原始模板.

If you have to do your own code, you resort to some very simple system. If your tracked object does not change too much and does not move violently, I would recommend using template matching. Once the detection differs some from the original template, you can update your template with a recent detection. This causes a drift. If the drift is too much, you can go back to the original template.

但是请注意:在跟踪中进行修补没有太大的期望... Lucas-Kanade仅在研究论文中具有很强的实力. ;)

Note however: there is not much to expect from tinkering at tracking... Lucas-Kanade is only robust in the research papers. ;)

这篇关于使用OpenCV跟踪对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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