单个人从视频序列跟踪 [英] single person tracking from video sequence

查看:122
本文介绍了单个人从视频序列跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为我的论文工作的一部分,我需要从视频或图片序列中构建一个用于人类跟踪的程序,如 KTH IXMAS 数据集,假设如下:

As a part of my thesis work, I need to build a program for human tracking from video or image sequence like the KTH or IXMAS dataset with the assumptions:


  • 照明保持不变

  • 只有一个人出现在场景中

程序需要实时执行

我搜索了很多,但仍然找不到一个好的解决方案。

I have searched a lot but still can not find a good solution.

请建议我一个合适的方法或现有的程序。

Please suggest me a good method or an existing program that is suitable.

推荐答案

情况1 - 如果相机静态

如果相机是静态的,跟踪一个人真的很简单。

If the camera is static, it is really simple to track one person.

您可以应用称为背景减法的方法。

You can apply a method called background subtraction.


  1. 在这里,为了获得更好的效果,你需要一个来自相机的裸露图像,它是背景。 (也可以这样做,即使你没有这个背景图片,但如果你有它,我会告诉结束如果没有背景图片做什么)

  1. Here, for better results, you need a bare image from camera, with no persons in it. It is the background. ( It can also be done, even if you don't have this background image. But if you have it, better. I will tell at end what to do if no background image)

现在开始从相机捕获。

Now start capture from camera. Take first frame,convert both to grayscale, smooth both images to avoid noise.

从帧中减去背景图像。

Subtract background image from frame.

如果框架没有背景图片变化(即没有人),您会得到黑色图片(当然会有一些噪音,它)。

If the frame has no change wrt background image (ie no person), you get a black image ( Of course there will be some noise, we can remove it). If there is change, ie person walked into frame, you will get an image with person and background as black.

现在为图像设置一个合适的值,如果有变化,即人物走进框架,你会得到一个人物和背景的图像为黑色。

Now threshold the image for a suitable value.

应用一些侵蚀去除小颗粒噪声。

Apply some erosion to remove small granular noise. Apply dilation after that.

现在找到轮廓。很可能会有一个轮廓,即人。

Now find contours. Most probably there will be one contour,ie the person.

找到质心或任何您想要追踪的人。

Find centroid or whatever you want for this person to track.

现在假设您没有背景图片,可以使用 cvRunningAvg 功能。它查找您用于跟踪的视频中的帧的平均运动。但你可以明白,第一种方法是更好,如果你得到背景图像。

Now suppose you don't have a background image, you can find it using cvRunningAvg function. It finds running average of frames from your video which you use to track. But you can obviously understand, first method is better, if you get background image.

这里是使用cvRunningAvg的上述方法的实现

Case 2 - 相机不是静态的

由于您无法获得固定的背景,因此背景减法效果不佳。

Here background subtraction won't give good result, since you can't get a fixed background.

然后OpenCV附带一个用于人检测样本的示例。使用它。

Then OpenCV come with a sample for people detection sample. Use it.

这是文件: peopledetect.cpp

我还建议您访问这个处理几乎相同问题的SOF: a href =http://stackoverflow.com/questions/2188646/how-can-i-detect-and-track-people-using-opencv>如何使用OpenCV检测和跟踪用户?

I also recommend you to visit this SOF which deals with almost same problem: How can I detect and track people using OpenCV?

这篇关于单个人从视频序列跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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