图像特征提取方法=特征选择与描述

2024-11-25 15:40:05
推荐回答(4个)
回答1:

#include "stdafx.h"
#include "DIPAX.h"
#include "FeaturesDlg.h"

#include "Global.h"
#include "BaseList.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CFeaturesDlg dialog

CFeaturesDlg::CFeaturesDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFeaturesDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFeaturesDlg)
m_nSize = 0;
m_nLength = 0;
//}}AFX_DATA_INIT
m_pParent=pParent;
m_pImage_in=NULL;
m_pImage_out=NULL;

m_pImage_label = NULL;
m_fsize = NULL;
m_fradio = NULL;
m_flength = NULL;

m_ncenter_x = NULL;
m_ncenter_y = NULL;
}

void CFeaturesDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFeaturesDlg)
DDX_Text(pDX, IDC_FEATURES_EDIT1, m_nSize);
DDX_Text(pDX, IDC_FEATURES_EDIT2, m_nLength);
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CFeaturesDlg, CDialog)
//{{AFX_MSG_MAP(CFeaturesDlg)
ON_BN_CLICKED(ID_FEATURES_OK, OnFeaturesOk)
ON_BN_CLICKED(ID_FEATURES_CANCEL, OnFeaturesCancel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFeaturesDlg message handlers

BOOL CFeaturesDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here
m_nxsize=::GetXSize();
m_nysize=::GetYSize();
if(::GetImageType()==24)
return FALSE;
m_pImage_in=new BYTE[m_nxsize*m_nysize];
m_pImage_out=new BYTE[m_nxsize*m_nysize];

//读入表示的图像数据
::ReadImageData(m_pImage_in);

//区域个数初始化
m_ncnt = 0;

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

void CFeaturesDlg::OnFeaturesOk()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
// ::ReadImageData(m_pImage_in);

int i, j;
//消除周围像素
for( i = 0; i < m_xsize; i++)
{
*(m_pImage_in + i) = 0;
*(m_pImage_in + m_xsize + i) = 0;
*(m_pImage_in + (m_ysize-1)*m_xsize + i) = 0;
*(m_pImage_in + (m_ysize-2)*m_xsize + i) = 0;
}
for( j = 0; j < m_ysize; j++)
{
*(m_pImage_in + j*m_xsize ) = 0;
*(m_pImage_in + j*m_xsize + 1 ) = 0;
*(m_pImage_in + j*m_xsize + m_xsize-1) = 0;
*(m_pImage_in + j*m_xsize + m_xsize-2) = 0;
}

//贴标签处理(区域处理)
int nRnt = Labeling(m_pImage_in, m_pImage_label, m_xsize, m_ysize, &m_ncnt);

if(nRnt == -1)//标签个数太多
{
m_ncnt = 0;
return;
}
if(m_ncnt == 0)//没有测试对象
return;

//分配内存
m_fradio = new float[m_ncnt];
m_fsize = new float[m_ncnt];
m_flength = new float[m_ncnt];
m_ncenter_x = new int[m_ncnt];
m_ncenter_y = new int[m_ncnt];

//测算特征数据
::Features(m_pImage_label, m_pImage_out, m_xsize, m_ysize, m_ncnt, m_fsize,
m_flength, m_fradio, m_ncenter_x, m_ncenter_y);

// Features(m_pImage_in,m_pImage_out,m_nxsize,m_nysize,cnt,calc_size,calc_length,ratio,center_x,center_y);
::Disp_image(m_pImage_out);
m_pParent->Invalidate();
}

void CFeaturesDlg::OnFeaturesCancel()
{
// TODO: Add your control notification handler code here
// delete [] m_pImage_in;
// delete [] m_pImage_out;
//解放内存

if(m_pImage_in)
{
delete [] m_pImage_in;
m_pImage_in = NULL;
}
if(m_pImage_label)
{
delete [] m_pImage_label;
m_pImage_label = NULL;
}
if(m_pImage_out)
{
delete [] m_pImage_out;
m_pImage_out = NULL;
}

if(m_fsize)
{
delete [] m_fsize;
m_fsize = NULL;
}
if(m_fradio)
{
delete [] m_fradio;
m_fradio = NULL;
}

if(m_flength)
{
delete [] m_flength;
m_flength = NULL;
}

if(m_ncenter_x)
{
delete [] m_ncenter_x;
m_ncenter_x = NULL;
}

if(m_ncenter_y)
{
delete [] m_ncenter_y;
m_ncenter_y = NULL;
}
CDialog::OnCancel();
}

回答2:

(1)提取简单,时间和空间复杂度低.
(2)区分能力强,对图像视觉内容相似的图像其特征描述之间也应相近,反
之,对于视觉内容不相似的图像其特征描述之间应有一定的差别.
(3)与人的视觉感知相近,对人的视觉感觉相近的图像其特征描述之间也相
近,对人的视觉感知有差别的图像其特征描述之间也有一定的差别.
(4)抗干扰能力强,鲁棒性好,对图像大小,方向不敏感,具有几何平移,
旋转不变性.

回答3:

你的问题太专业了,建议去一些专业的论坛去看看.....
帮你找了半天,没找到

回答4:

给你点资料看看!