mfc_opencvdoc.cpp
来自「在MFC上应用OPENCV的教程。有详细的编程方法和截图。可以参考使用。」· C++ 代码 · 共 118 行
CPP
118 行
// MFC_OpenCVDoc.cpp : implementation of the CMFC_OpenCVDoc class
//
#include "stdafx.h"
#include "MFC_OpenCV.h"
#include "MFC_OpenCVDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMFC_OpenCVDoc
IMPLEMENT_DYNCREATE(CMFC_OpenCVDoc, CDocument)
BEGIN_MESSAGE_MAP(CMFC_OpenCVDoc, CDocument)
//{{AFX_MSG_MAP(CMFC_OpenCVDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMFC_OpenCVDoc construction/destruction
CMFC_OpenCVDoc::CMFC_OpenCVDoc()
{
// TODO: add one-time construction code here
}
CMFC_OpenCVDoc::~CMFC_OpenCVDoc()
{
}
BOOL CMFC_OpenCVDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMFC_OpenCVDoc serialization
void CMFC_OpenCVDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CMFC_OpenCVDoc diagnostics
#ifdef _DEBUG
void CMFC_OpenCVDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CMFC_OpenCVDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMFC_OpenCVDoc commands
BOOL CMFC_OpenCVDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: Add your specialized creation code here
m_image.Load(lpszPathName);
MyImage.CopyOf(m_image);
return TRUE;
}
BOOL CMFC_OpenCVDoc::CanCloseFrame(CFrameWnd* pFrame)
{
// TODO: Add your specialized code here and/or call the base class
return CDocument::CanCloseFrame(pFrame);
}
BOOL CMFC_OpenCVDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
// TODO: Add your specialized code here and/or call the base class
m_image.Save(lpszPathName);
return CDocument::OnSaveDocument(lpszPathName);
}
void CMFC_OpenCVDoc::DeleteContents()
{
// TODO: Add your specialized code here and/or call the base class
CDocument::DeleteContents();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?