📄 identifydlg.cpp
字号:
// IdentifyDlg.cpp : implementation file
//
#include "stdafx.h"
#include "水果识别.h"
#include "IdentifyDlg.h"
#include "bp.h"
//#include "bpex.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
//static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CIdentifyDlg dialog
CIdentifyDlg::CIdentifyDlg(CWnd* pParent /*=NULL*/)
: CDialog(CIdentifyDlg::IDD, pParent)
{
EnableAutomation();
//{{AFX_DATA_INIT(CIdentifyDlg)
m_sIdf = _T("");
//}}AFX_DATA_INIT
}
void CIdentifyDlg::OnFinalRelease()
{
// When the last reference for an automation object is released
// OnFinalRelease is called. The base class will automatically
// deletes the object. Add additional cleanup required for your
// object before calling the base class.
CDialog::OnFinalRelease();
}
void CIdentifyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CIdentifyDlg)
DDX_Control(pDX, IDC_MYBITMAP, m_ctlBitmap);
DDX_Text(pDX, IDC_EDIT1, m_sIdf);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CIdentifyDlg, CDialog)
//{{AFX_MSG_MAP(CIdentifyDlg)
ON_BN_CLICKED(IDC_ROUND, OnRound)
ON_BN_CLICKED(IDC_SMOOTH, OnSmooth)
ON_BN_CLICKED(IDC_BIG, OnBig)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DISPATCH_MAP(CIdentifyDlg, CDialog)
//{{AFX_DISPATCH_MAP(CIdentifyDlg)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
// Note: we add support for IID_IIdentifyDlg to support typesafe binding
// from VBA. This IID must match the GUID that is attached to the
// dispinterface in the .ODL file.
// {E16EC336-0990-4FBD-A568-3AC4968EC35F}
static const IID IID_IIdentifyDlg =
{ 0xe16ec336, 0x990, 0x4fbd, { 0xa5, 0x68, 0x3a, 0xc4, 0x96, 0x8e, 0xc3, 0x5f } };
BEGIN_INTERFACE_MAP(CIdentifyDlg, CDialog)
INTERFACE_PART(CIdentifyDlg, IID_IIdentifyDlg, Dispatch)
END_INTERFACE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CIdentifyDlg message handlers
void CIdentifyDlg::OnOK()
{
CBitmap bmpLoad;
double rst;
int m;//类别的转化整数
rst=recognize(m_i2recog);
m=(int)(rst*4);
switch(m){
case 5:
case 4:
case 3:
m_sIdf=_T("苹果");
bmpLoad.LoadBitmap(IDB_BITMAP2);
m_ctlBitmap.SetBitmap(bmpLoad);
break;
case 2:
m_sIdf=_T("桔子");
bmpLoad.LoadBitmap(IDB_BITMAP3);
m_ctlBitmap.SetBitmap(bmpLoad);
break;
case 1:
case 0:
m_sIdf=_T("海棠");
bmpLoad.LoadBitmap(IDB_BITMAP4);
m_ctlBitmap.SetBitmap(bmpLoad);
break;
default:
m_sIdf=_T("识别错误!");
// AfxMessageBox("出错了!!",m,1);
}
UpdateData(FALSE);
// TODO: Add extra validation here
//CDialog::OnOK();
}
void CIdentifyDlg::OnBig()
{
m_i2recog[0]=1.0;
m_i2recog[1]=0.0;
m_i2recog[2]=0.0;
// TODO: Add your control notification handler code here
}
void CIdentifyDlg::OnRound()
{
m_i2recog[0]=0.0;
m_i2recog[1]=1.0;
m_i2recog[2]=0.0;
// TODO: Add your control notification handler code here
}
void CIdentifyDlg::OnSmooth()
{
m_i2recog[0]=0.0;
m_i2recog[1]=0.0;
m_i2recog[2]=1.0;
// TODO: Add your control notification handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -