通过opencv和python实时跟踪对象 [英] object tracking in real time via opencv and python

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

问题描述

我正在寻找好的算法来实时进行对象跟踪。
我发现到目前为止最好的是camshift,但问题是我需要对象检测来自外侧图像。(我给算法一个图像,他在视频中找到它...)使用鼠标选择ROI点需要和camshift。我试图改变它,但它没有成功。
我愿意学习新算法或更改camshift。

I'm looking for good algorithm to do object tracking in real time. the best one I found so far was camshift but the problem with that is that I need to object detection will come from out side image.(I give the algorithm an image and he find it in the video...) and camshift required to select the ROI points with the mouse. I tried to change it but it didn't succeed. I'm open to learn new algorithm or to change the camshift.

谢谢。

推荐答案

我不知道camshift非常好,但我猜你正在使用 opencv 实施。以下代码是opencv示例的代码段:

I don't know camshift very well, but i'm guessing you are using opencv implementation. The below code is a snippet from the opencv example:

        hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
        dst = cv2.calcBackProject([hsv],[0],roi_hist,[0,180],1)

        # apply meanshift to get the new location
        ret, track_window = cv2.CamShift(dst, track_window, term_crit)

对于第一张图片,选择 dst 与帧大小一样大可以解决您的问题。否则,您可以使用滑动窗口方法在第一帧中定位目标。

For the first image, choosing the dst as large as the frame size should solve your problem. Otherwise you can use a sliding window approach to locate the target in the first frame.

另一方面,术语实时真正取决于您的要求和部署环境这些方面:

On the other hand, the term real time really depends on your requirements and deployment environment in such aspects:


  • 输入视频的帧率

  • 帧的分辨率

  • 框架的颜色方案(rgb,yuv,灰色,hsv,...)

  • 最大/最小目标尺寸

  • 最大目标速度(像素/帧)

  • 它应该对遮挡有效吗?

  • 你的目标最具体的属性是什么:汽车,人类/动物,固体物体,变形,转动......

  • 您使用的是CPU,DSP还是GPU?

  • ...

  • frame rate of input video
  • resolution of the frames
  • color scheme of the frame (rgb, yuv, gray, hsv, ...)
  • maximum/minimum target size
  • maximum target speed (pixels/frame)
  • should it be robust to occlusions?
  • what's the most specific properties of your targets: cars, human/animals, solid objects, changing shape, turning, ...
  • are you using a CPU, DSP or GPU?
  • ...

由于上述所有考虑因素对您的选择都非常有效,我不能向您推荐具体的考虑因素。例如,这个可能很有用。

Since all of the considerations above would be really effective on your choice, i cannot recommend you a specific one. This one may be useful for example.

我会深入了解 IEEE探索并进行搜索,例如实时对象跟踪。我为你做了一个:) 这里是你最好的起点,我想。

I would dig into IEEE explore and make a search such as real time object tracking. I did one for you :) Here is your best start point, i guess.

希望这会有所帮助。
Gokhan。

Hope this helps. Gokhan.

这篇关于通过opencv和python实时跟踪对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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