aihot  2017-04-27 09:27:31  OpenCV |   查看评论   

 运动检测(前景检测)之(一)ViBe


       因为监控发展的需求,目前前景检测的研究还是很多的,也出现了很多新的方法和思路。个人了解的大概概括为以下一些:

       帧差、背景减除(GMM、CodeBook、 SOBS、 SACON、 VIBE、 W4、多帧平均……)、光流(稀疏光流、稠密光流)、运动竞争(Motion Competition)、运动模版(运动历史图像)、时间熵……等等。如果加上他们的改进版,那就是很大的一个家族了。

       ViBe是一种像素级视频背景建模或前景检测的算法,效果优于所熟知的几种算法,对硬件内存占用也少,很简单。我之前根据stellar0的(在这里,非常感谢stellar0)改写成一个Mat格式的了,现在摆上来和大家交流,具体如下:(在VS2010+OpenCV2.4.2中测试通过)


ViBe.h

  1. #pragma once  
  2. #include <iostream>  
  3. #include "opencv2/opencv.hpp"  
  4.   
  5. using namespace cv;  
  6. using namespace std;  
  7.   
  8. #define NUM_SAMPLES 20      //每个像素点的样本个数  
  9. #define MIN_MATCHES 2       //#min指数  
  10. #define RADIUS 20       //Sqthere半径  
  11. #define SUBSAMPLE_FACTOR 16 //子采样概率  
  12.   
  13.   
  14. class ViBe_BGS  
  15. {  
  16. public:  
  17.     ViBe_BGS(void);  
  18.     ~ViBe_BGS(void);  
  19.   
  20.     void init(const Mat _image);   //初始化  
  21.     void processFirstFrame(const Mat _image);  
  22.     void testAndUpdate(const Mat _image);  //更新  
  23.     Mat getMask(void){return m_mask;};  
  24.   
  25. private:  
  26.     Mat m_samples[NUM_SAMPLES];  
  27.     Mat m_foregroundMatchCount;  
  28.     Mat m_mask;  
  29. };  

 

ViBe.cpp

     1/6    1 2 3 4 5 6 下一页 尾页
 

除特别注明外,本站所有文章均为 赢咖4注册 原创,转载请注明出处来自运动检测(前景检测)之(一)ViBe

留言与评论(共有 0 条评论)
   
验证码:
[lianlun]1[/lianlun]