/********************************************************************************************
Averaging Background Method
平均背景法
We’ve just seen a simple method of learning background scenes and segmenting fore-
ground objects. It will work well only with scenes that do not contain moving background
components (like a waving curtain or waving trees). It also assumes that the lighting
remains fairly constant (as in indoor static scenes).
*********************************************************************************************/
#include "cv.h"
#include "highgui.h"
/*******************************************************/
//全局变量:我们为需要的不同临时图像和统计属性的图像创建指针
/*Float 3-channel images*/
IplImage* IavgF, *IdiffF, *IprevF, *IhiF, *IlowF;
IplImage* Iscratch, *Iscratch2;
/*Float 1-channel images*/
IplImage* Igray1, *Igray2, *Igray3;
IplImage* Ilow1, *Ilow2, *Ilow3;
IplImage* Ihi1, *Ihi2, *Ihi3;
/*Byte 1-channel image*/
IplImage* Imaskt;
IplImage* Imask;
float Icount;
/******************************************************/
/*该函数为需要的所有临时图像分配内存,传入来自视频的首帧图像作为大小参考*/
void AllocateImages( IplImage* I )
{
CvSize sz = cvGetSize(I);
/*Float 3-channel images*/
IavgF = cvCreateImage(sz, IPL_DEPTH_32F, 3);
IdiffF = cvCreateImage(sz, IPL_DEPTH_32F, 3);
IprevF = cvCr
《学习OpenCV》平均距离法实现背景建模(page300)
最新推荐文章于 2024-04-17 21:31:56 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)