检测人穿越OpenCV的一条线 [英] Detecting people crossing a line with OpenCV

查看:1186
本文介绍了检测人穿越OpenCV的一条线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想算的人从路口两侧的行号。我有一个放置在天花板和拍摄的地板,其中线是一个摄像头(所以摄像头看到只是顶部的人头上;因此它是多个对象的检测比人检测)。

I want to count number of people crossing a line from either side. I have a camera that is placed on ceiling and shooting for the floor where the line is (So camera sees just top of people heads; and so it is more of object detection than people detection).

是否有这个问题,或者像这样类似的问题,任何样品溶液?所以,我可以从他们身上学到什么?

Is there any sample solution for this problem or similar problems like this? So I can learn from them?

编辑1:不止一个人越线在任何时刻

Edit 1: More than one person is crossing the line at any moment.

推荐答案

如果没有别的,但人们都受到交行,那么你需要不检测的人,你只需要检测运动。 有几种方法进行motoin检测。

If nothing else but humans are subject to cross the line then you need not to detect people you only have to detect motion. There are several approaches for motoin detection.

可能是最简单的选择一个适合自己的目标。您只需计算视频流的连续帧和这样的差异决定的议案面具,从而检测线交叉事件

Probably the simplest one fits your goals. You simply calculate difference between successive frames of video stream and this way determine "motion mask" and thus detect line crossing event

由于这种算法的改进,你可以考虑移动平均的方法。

As an improvement of this "algorithm" you may consider "running average" method.

要确定运动的方向,你可以用Motion模板。

To determine a direction of motion you can use "motion templates".

为了增加你的探测器的精度,你可以尝试任何背景减法技术(这又不是一个简单的解决方案)。例如,如果有一些移动背景应该被过滤掉(例如,使用统计学习)

In order to increase accuracy of your detector you may try any background subtraction technique (which in turn is not a simple solution). For example, if there is some moving background which should be filtered out (e.g. using statistical learning)

提及的所有的算法都包括在OpenCV库

All algorithms mentioned are included in OpenCV library.

UPD:

  • <一个href="http://stackoverflow.com/questions/4756690/finding-image-silhouette-using-opencv/4759556#4759556">how计算运动口罩
  • 有用的函数,用于确定运动方向 cvCalcMotionGradient cvSegmentMotion cvUpdateMotionHistory (<一href="http://opencv.willowgarage.com/documentation/search.html?q=motion&check_keywords=yes&area=default"相对=nofollow>搜索文档)。 OpenCV库包含例如code的运动分析,看到的 motempl.c
  • <一个href="http://books.google.com/books?id=seAgiOfu2EIC&pg=PA265&lpg=PA265&dq=opencv%20background%20subtraction&source=bl&ots=hSD3ehjHOe&sig=MuQ6EV00kBV11Bnx3nnMdwVNafs&hl=en&ei=qV-4TcngG4WhOv6ojJAP&sa=X&oi=book_result&ct=result&resnum=5&sqi=2&ved=0CEYQ6AEwBA#v=onepage&q=opencv%20background%20subtraction&f=false"相对=nofollow>从学习OpenCV的书先进的背景减除
  • how to compute motion mask
  • Useful functions for determining motion direction cvCalcMotionGradient, cvSegmentMotion, cvUpdateMotionHistory (search docs). OpenCV library contains example code for motion analysis, see motempl.c
  • advanced background subtraction from "Learning OpenCV" book

这篇关于检测人穿越OpenCV的一条线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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