第一范文网 - 专业文章范例文档资料分享平台

SLIC超像素分割算法和目前超像素算法的比较代码实现 - 图文 (10)

来源:用户分享 时间:2020-06-09 本文由远水孤云 分享 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

/// the input is greyscale with values ranging from 0-100, then a compactness /// value of 20.0 would give good results. A greater value will make the /// supervoxels more compact while a smaller value would make them more uneven. //=========================================================================== void SLIC::DoSupervoxelSegmentation(

unsigned int**& const int& const int& const int& int**& int&

ubuffvec, width, height, depth, klabels, supervoxelsize,

numlabels,

const int& {

const double& compactness)

//--------------------------------------------------------- const int STEP = 0.5 + pow(double(supervoxelsize),1.0/3.0); //---------------------------------------------------------

//-------------------------------------------------- m_width = width; m_height = height; m_depth = depth;

int sz = m_width*m_height;

//-------------------------------------------------- m_lvecvec = new double*[depth]; m_avecvec = new double*[depth]; m_bvecvec = new double*[depth]; for( int d = 0; d < depth; d++ ) {

m_lvecvec[d] = new double[sz]; m_avecvec[d] = new double[sz]; m_bvecvec[d] = new double[sz]; vector kseedsl(0); vector kseedsa(0); vector kseedsb(0); vector kseedsx(0); vector kseedsy(0); vector kseedsz(0);

//klabels = new int*[depth];

//klabels[d] = new int[sz];

}

}

for( int s = 0; s < sz; s++ ) { }

klabels[d][s] = -1;

DoRGBtoLABConversion(ubuffvec, m_lvecvec, m_avecvec, m_bvecvec);

GetKValues_LABXYZ(kseedsl, kseedsa, kseedsb, kseedsx, kseedsy, kseedsz, STEP);

PerformSupervoxelSLIC(kseedsl, kseedsa, kseedsb, kseedsx, kseedsy, kseedsz, klabels, STEP,

compactness);

EnforceSupervoxelLabelConnectivity(klabels, width, height, depth, numlabels, STEP);

SLICSuperpixels.cpp

// SLICSuperpixels.cpp : Defines the class behaviors for the application. //

#include \

#include \ #include \

#ifdef _DEBUG

#define new DEBUG_NEW #endif

// CSLICSuperpixelsApp

BEGIN_MESSAGE_MAP(CSLICSuperpixelsApp, CWinAppEx)

// CSLICSuperpixelsApp construction

ON_COMMAND(ID_HELP, &CWinApp::OnHelp) END_MESSAGE_MAP()

CSLICSuperpixelsApp::CSLICSuperpixelsApp() { }

// The one and only CSLICSuperpixelsApp object

CSLICSuperpixelsApp theApp;

// CSLICSuperpixelsApp initialization

BOOL CSLICSuperpixelsApp::InitInstance() {

CSLICSuperpixelsDlg dlg; m_pMainWnd = &dlg;

INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { }

else if (nResponse == IDCANCEL) { }

// TODO: Place code here to handle when the dialog is // dismissed with Cancel

// TODO: Place code here to handle when the dialog is // dismissed with OK // Standard initialization

// If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored // TODO: You should modify this string to be something appropriate // such as the name of your company or organization

SetRegistryKey(_T(\)); CWinAppEx::InitInstance();

// TODO: add construction code here,

// Place all significant initialization in InitInstance

}

// Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE;

SLICSuperpixelsDlg.cpp

// SLICSuperpixelsDlg.cpp : implementation file //

#include \

#include \ #include \ #include \ #include \

#ifdef _DEBUG

#define new DEBUG_NEW #endif

// CSLICSuperpixelsDlg dialog

CSLICSuperpixelsDlg::CSLICSuperpixelsDlg(CWnd* pParent /*=NULL*/) { }

void CSLICSuperpixelsDlg::DoDataExchange(CDataExchange* pDX) {

CDialog::DoDataExchange(pDX);

m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); : CDialog(CSLICSuperpixelsDlg::IDD, pParent) , m_spcount(0) , m_compactness(0)

}

DDX_Text(pDX, IDC_EDIT_SPCOUNT, m_spcount); DDV_MinMaxInt(pDX, m_spcount, 1, 10000000);

DDX_Text(pDX, IDC_EDIT_COMPACTNESS, m_compactness); DDV_MinMaxDouble(pDX, m_compactness, 1.0, 80.0);

BEGIN_MESSAGE_MAP(CSLICSuperpixelsDlg, CDialog)

// CSLICSuperpixelsDlg message handlers

BOOL CSLICSuperpixelsDlg::OnInitDialog() { }

void CSLICSuperpixelsDlg::OnEnChangeEditSpcount() {

// TODO: If this is a RICHEDIT control, the control will not

// send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask()

return TRUE; // return TRUE unless you set the focus to a control // TODO: Add extra initialization here m_spcount = 200; m_compactness = 10.0;

UpdateData(FALSE);//FALSE to set data, TRUE to retrieve data

// Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE);

// Set big icon

SetIcon(m_hIcon, FALSE);

// Set small icon

CDialog::OnInitDialog(); ON_WM_PAINT()

ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP

ON_BN_CLICKED(IDC_BUTTON_CREATESUPERPIXELS,

ON_EN_CHANGE(IDC_EDIT_SPCOUNT, &CSLICSuperpixelsDlg::OnEnChangeEditSpcount)

ON_EN_CHANGE(IDC_EDIT_COMPACTNESS, &CSLICSuperpixelsDlg::OnEnChangeEditCompactness)

&CSLICSuperpixelsDlg::OnBnClickedButtonCreatesuperpixels)

END_MESSAGE_MAP()

搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新IT计算机SLIC超像素分割算法和目前超像素算法的比较代码实现 - 图文 (10)全文阅读和word下载服务。

SLIC超像素分割算法和目前超像素算法的比较代码实现 - 图文 (10).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/wenku/1078828.html(转载请注明文章来源)
热门推荐
Copyright © 2018-2022 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top