⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vfwimageprocessor.h

📁 本课题的主要内容是图像预处理,它主要从摄像头中获取人脸图像然后进行处理,以便提高定位和识别的准确率.该模块主要包含光线补偿、图像灰度化、高斯平滑、均衡直方图、图像对比度增强
💻 H
字号:
// VFWImageProcessor.h: interface for the CVFWImageProcessor class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_VFWIMAGEPROCESSOR_H__635099B7_63C1_11D4_9EF0_000083A26E84__INCLUDED_)
#define AFX_VFWIMAGEPROCESSOR_H__635099B7_63C1_11D4_9EF0_000083A26E84__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#include <afxmt.h>
#include <vfw.h>
#include <afxole.h>

#define MAX_VFW_DEVICES    10

//class AFX_EXT_CLASS CVFWImageProcessor
class CVFWImageProcessor
{
public:
   CVFWImageProcessor();
   virtual ~CVFWImageProcessor();
   CVFWImageProcessor(const CVFWImageProcessor &CopyFrom);
   CVFWImageProcessor &operator =(const CVFWImageProcessor &CopyFrom);

   BOOL Initialize(SHORT DriverIndex = 0);
   VOID Destroy();

   BOOL SetDriver(SHORT DriverIndex);

   HWND GetCapWindow();

   BOOL CaptureDIB(PBITMAPINFO *Bitmap, ULONG BitmapLength, ULONG *RetBitmapLength);
   BOOL CaptureAVI(LPCTSTR Filename, FLOAT FramesPerSec, ULONG Duration, UINT Quality);                            
   BOOL EnablePreviewVideo(HWND Parent, INT x, INT y, INT PreviewRate = 30);
   BOOL EnablePreviewVideo(HWND Parent, INT x, INT y, INT Width, INT Height, INT PreviewRate = 30);
   BOOL DisablePreviewVideo();
   BOOL DriverGetCaps(CAPDRIVERCAPS *Caps);
   BOOL DlgVideoSource();
   BOOL DlgVideoFormat();
   BOOL DlgVideoDisplay();
   VOID CancelCapture();
   BOOL AllocDIBImage(PBITMAPINFO *ppImageData, ULONG *AllocatedSize);

   BITMAPINFOHEADER GetBitmapInfoHeader();

   VOID GetPreviousError(INT *ErrorID, CString *ErrorString, BOOL ResetError = FALSE);

   static ULONG CalcBitmapSize(const BITMAPINFOHEADER &bmiHeader);
   static ULONG CalcBitmapInfoSize(const BITMAPINFOHEADER &bmiHeader);

   friend LRESULT CALLBACK ErrorCallbackProc(HWND hWnd, int nErrID, LPSTR lpErrorText);
   friend LRESULT CALLBACK ControlCallbackProc(HWND hWnd, int nState);
   friend LRESULT CALLBACK StatusCallbackProc(HWND hWnd, int nID, LPCSTR lpsz);
   friend LRESULT CALLBACK FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr);
   friend LRESULT CALLBACK StreamCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr);
 
   friend UINT CaptureThreadFunc(VOID *pCVFWImageProcessor);

private:    // Data
   HWND m_hWndVideo;
   CMutex m_ImageProtect;
   CEvent m_ImageReady;
   CEvent m_CancelCapture;
   CEvent m_CaptureEnded;

   BITMAPINFOHEADER m_BitmapInfoHeader;      // Used to store image dimensions.

   PBITMAPINFO m_TransferBitmapInfo;
   ULONG m_TransferBitmapInfoSize;

   CWinThread *m_CaptureThread;
   INT m_DriverIndex;

   INT m_ErrorID;
   CString m_ErrorText;

   static UINT m_ValidDriverIndex[MAX_VFW_DEVICES];
   static USHORT m_TotalVideoDrivers;

private:    // Functions
   CVFWImageProcessor &Copy(const CVFWImageProcessor &CopyFrom);
};

#endif // !defined(AFX_VFWIMAGEPROCESSOR_H__635099B7_63C1_11D4_9EF0_000083A26E84__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -