// Demo_MFCDlg.h : 头文件 // #pragma once #include "afxwin.h" #include "opencv.hpp" #include #include // CDemo_MFCDlg 对话框 class CDemo_MFCDlg : public CDialogEx { // 构造 public: CDemo_MFCDlg(CWnd* pParent = NULL); // 标准构造函数 // 对话框数据 enum { IDD = IDD_DEMO_MFC_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 virtual void PostNcDestroy(); // 实现 protected: HICON m_hIcon; // 生成的消息映射函数 virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnBnClickedBtnLoad1(); afx_msg void OnBnClickedBtnLoad2(); afx_msg void OnBnClickedBtnVerify(); afx_msg void OnBnClickedBtnInit(); afx_msg void OnBnClickedBtnCamera1(); afx_msg void OnBnClickedBtnCamera2(); afx_msg void OnBnClickedBtnOpenusb(); afx_msg void OnBnClickedBtnLoad3(); afx_msg void OnBnClickedBtnDet(); afx_msg LRESULT OnThreadShowVideo(WPARAM wPapam, LPARAM lPapam); DECLARE_MESSAGE_MAP() private: // [3/3/2017 Lit]:通过图片路径获取图片特征 int GetFeatureFromPath(const CString &sPath, void* pFeatueData); bool CreateFaceHandle(); void ReleaseFaceHandle(); void ThreadFaceDet(); void ShowVideo(char* szFrame,int iImgWidth,int iImgHeight); void ShowImg(CString sPicPath, HDC hDCVideo, RECT rectVideo); private: void* m_pDetHandle; // 检测线程中的检测句柄 void* m_pDetVerify; // 用于比对过程中的检测句柄 void* m_pRecogHandle; // 识别句柄 CEdit m_edtVersion; CEdit m_edtVerifyScore; CEdit m_edtVerifyResult; CEdit m_edtVerifyTime; CEdit m_edtFaceBuf; CStatic m_staticVideo; // 显示USB摄像头的控件 RECT m_rectVideo; HDC m_hDCVideo; CStatic m_staticPic1; RECT m_rectPic1; HDC m_hDCPic1; CStatic m_staticPic2; RECT m_rectPic2; HDC m_hDCPic2; CStatic m_staticPic3; RECT m_rectPic3; HDC m_hDCPic3; cv::VideoCapture m_capture; // 摄像头操作对象 cv::Mat m_matFrame; // 当前帧 std::thread m_threadFaceDet; // 检测线程 std::mutex m_mutex; // 锁 CString m_sPic1Path; // 图片1路径 CString m_sPic2Path; // 图片2路径 CString m_sPic3Path; // 图片3路径 bool m_bStartThread; // 是否开启检测线程 };