www.pudn.com > JingXiang-Design-Jeff.rar > ForStrongBorder.cpp
// ForStrongBorder.cpp : implementation file
//
#include "stdafx.h"
#include "Design.h"
#include "ForStrongBorder.h"
#include "MainFrm.h"
#include "DesignDoc.h"
#include "DesignView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ForStrongBorder dialog
ForStrongBorder::ForStrongBorder(CWnd* pParent /*=NULL*/)
: CDialog(ForStrongBorder::IDD, pParent)
{
::strcpy(Explain_Txt[0]," 该方法是一种各向同性的增强方法.经变换后,图象中亮度保持不变或线性缓慢变换的区域变黑,而象素值变化剧烈的区域经过变换后突出出来了.");
::strcpy(Explain_Txt[1]," 该方法首先将原图象平移一个象素,然后用原图象减去平移后的图象,所得结果反映了原图象亮度变化率的大小,对于图象中象素值保持不变的区域,相减结果为零,意味着象素为黑,对于象素值变化剧烈的区域,相减后得到了相应较大的变化率,对应的象素将变亮.");
::strcpy(Explain_Txt[2]," 经高通空间滤波器处理得到的图像中象素值之间的灰度差得到增强,而对象素值较恒定的区域则保持不变,从而收到对图象作边缘增强的效果.");
::strcpy(Explain_Txt[3]," 从原图象中减去经低通虑波器处理得到的图像的低频成份,所得图像高频成份相对增强,收到对图象作边缘增强的效果,且不增加新的噪音.");
//{{AFX_DATA_INIT(ForStrongBorder)
m_Explain = _T("");
m_StrongMethod = -1;
//}}AFX_DATA_INIT
}
void ForStrongBorder::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ForStrongBorder)
DDX_Text(pDX, IDC_FOR_STRONG_BORDER_EXPLAIN, m_Explain);
DDX_Radio(pDX, IDC_FOR_STRONG_BORDER_RADIO1, m_StrongMethod);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(ForStrongBorder, CDialog)
//{{AFX_MSG_MAP(ForStrongBorder)
ON_BN_CLICKED(IDC_FOR_STRONG_BORDER_RADIO1, OnForStrongBorderRadio1)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// ForStrongBorder message handlers
BOOL ForStrongBorder::OnInitDialog()
{
CDesignDoc *pDesignDoc;
CMainFrame* pMFrame=(CMainFrame*)(AfxGetApp()->m_pMainWnd);
pDesignDoc=(CDesignDoc*)pMFrame->GetActiveDocument();
this->m_StrongMethod=pDesignDoc->BitMap.StrongBorderMethod;
CDialog::OnInitDialog();
this->GetExplainText();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL ForStrongBorder::GetExplainText()
{
UpdateData(TRUE);
this->m_Explain=Explain_Txt[m_StrongMethod];
UpdateData(FALSE);
return TRUE;
}
void ForStrongBorder::OnForStrongBorderRadio1()
{
this->GetExplainText();
}
void ForStrongBorder::OnRadio2()
{
this->GetExplainText();
}
void ForStrongBorder::OnRadio3()
{
this->GetExplainText();
}
void ForStrongBorder::OnRadio4()
{
this->GetExplainText();
}
void ForStrongBorder::OnOK()
{
UpdateData();
CDesignDoc *pDesignDoc;
CMainFrame* pMFrame=(CMainFrame*)(AfxGetApp()->m_pMainWnd);
pDesignDoc=(CDesignDoc*)pMFrame->GetActiveDocument();
pDesignDoc->BitMap.StrongBorderMethod=this->m_StrongMethod;
CDialog::OnOK();
}