StaticDetect.h
上传用户:smdfuse
上传日期:2015-11-06
资源大小:98k
文件大小:2k
- // StatsticDetect.h: interface for the CStatsticDetect class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_STATSTICDETECT_H__7B40C0FB_7939_4E8A_9E3C_54F9008F0416__INCLUDED_)
- #define AFX_STATSTICDETECT_H__7B40C0FB_7939_4E8A_9E3C_54F9008F0416__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "StructDefine.h"
- #define BACK_ALL_NUM 100 //计算背景所需帧数
- #define BACK_SEQ_NUM 3 //背景计算循环数目
- #define THRESHOLD 20 //设置差分阈值
- class CStatsticDetect
- {
- public:
- CStatsticDetect(int nwidth, int nheight);
- virtual ~CStatsticDetect();
- void ReceiveFrame(int index, BYTE* sBuf, DETECT_METHOD sMethod); //主调用函数
- public:
- BYTE *m_pCurImage; //当前图像
- BYTE *m_pBgImage; //背景图像
- BYTE *m_pDetectImage; //检测结果图像
-
- //private:
- int m_nFrame, count;
- int WIDTH, HEIGHT,IMAGESIZE;
- short int *m_pBackHistgram; //背景颜色统计
- BYTE *m_pGrayImage; //当前灰度图像
- BYTE *m_pBackground; //背景
- BYTE *m_pDiffImage; //差分图像
- UINT *m_pTemplate; //存取多帧数据
- BYTE *m_pPreGrayImage; //存取前一帧灰度图像
- BYTE *image1;
- BYTE *image2;
- BYTE *image3;
- BYTE *image4;
- public :
- void RGBToYUV(BYTE *sRGB,BYTE *sGray,int nWidth, int nHeight);
- void SetBgHistgram(short int *pHistgram, BYTE *sGray,int nWidth, int nHeight);
- BOOL GetBgByHistgram(short int *pHistgram,BYTE *sBg,int nWidth,int nHeight);
- void DiffImage(BYTE *sGray,BYTE *pGray,int nWidth, int nHeight,int nThreshold);
- void DeNoise(BYTE *sGray,int nWidth, int nHeight);
- void Medianfilter_3x3(BYTE *sGray, int nWidth, int nHeight);
- void Dilation(BYTE *sGray,int nWidth, int nHeight,int structure[3][3]);
- void Erosion(BYTE *sGray,int nWidth, int nHeight,int structure[3][3]);
- void GetMultiData(BYTE *sGray,int nWidth, int nHeight);
- void GetBgImage();
- void SaveBmp(BYTE* buffer,int nwidth, int nheight, int bit, int index);
- void ImageCopy(BYTE *sGray, int m_num);
- void Subtract(BYTE *nImage, BYTE *nImage1, BYTE *nImage2, int nWidth, int nHeight, int nThresh);
- void MDiffImage(BYTE *sGray,int nWidth, int nHeight, int nthresh);
- };
- #endif // !defined(AFX_STATSTICDETECT_H__7B40C0FB_7939_4E8A_9E3C_54F9008F0416__INCLUDED_)