前景检测算法.doc

  1. 1、本文档共31页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
前景检测算法

前景检测算法_1(codebook和平均背景法) ????? 前景分割中一个非常重要的研究方向就是背景减图法,因为背景减图的方法简单,原理容易被想到,且在智能视频监控领域中,摄像机很多情况下是固定的,且背景也是基本不变或者是缓慢变换的,在这种场合背景减图法的应用驱使了其不少科研人员去研究它。 ????? 但是背景减图获得前景图像的方法缺点也很多:比如说光照因素,遮挡因素,动态周期背景,且背景非周期背景,且一般情况下我们考虑的是每个像素点之间独立,这对实际应用留下了很大的隐患。 ????? 这一小讲主要是讲简单背景减图法和codebook法。 ? 一、简单背景减图法的工作原理。 ????? 在视频对背景进行建模的过程中,每2帧图像之间对应像素点灰度值算出一个误差值,在背景建模时间内算出该像素点的平均值,误差平均值,然后在平均差值的基础上+-误差平均值的常数(这个系数需要手动调整)倍作为背景图像的阈值范围,所以当进行前景检测时,当相应点位置来了一个像素时,如果来的这个像素的每个通道的灰度值都在这个阈值范围内,则认为是背景用0表示,否则认为是前景用255表示。 ????? 下面的一个工程是learning opencv一书中作者提供的源代码,关于简单背景减图的代码和注释如下: ?????avg_background.h文件: 1 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2 // Accumulate average and ~std (really absolute difference) image and use this to detect background and foreground 3 // 4 // Typical way of using this is to: 5 // AllocateImages(); 6 ////loop for N images to accumulate background differences 7 // accumulateBackground(); 8 ////When done, turn this into our avg and std model with high and low bounds 9 // createModelsfromStats(); 10 ////Then use the function to return background in a mask (255 == foreground, 0 == background) 11 // backgroundDiff(IplImage *I,IplImage *Imask, int num); 12 ////Then tune the high and low difference from average image background acceptance thresholds 13 // float scalehigh,scalelow; //Set these, defaults are 7 and 6. Note: scalelow is how many average differences below average 14 // scaleHigh(scalehigh); 15 // scaleLow(scalelow); 16 ////That is, change the scale high and low bounds for what should be background to make it work. 17 ////Then continue detecting foreground in the mask image 18 // backgroundDiff(IplImage *I,IplImage *Imask, int num); 19 // 20 //NOTES: num is camera number which varies from 0 ... NUM_CAMERAS - 1. Typically you only have one camera, but this routine allows 21 // you to index many. 22 // 23 #ifndef AVGSEG_ 24 #define AVGSEG_ 25 26 27 #include cv

文档评论(0)

haihang2017 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档