SLIC超像素分割算法和目前超像素算法的比较代码实现

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Resource.h

//{{NO_DEPENDENCIES}}

// Microsoft Visual C++ generated include file.

// Used by SLICSuperpixels.rc

//

#define IDD_SLICSUPERPIXELS_DIALOG 102

#define IDR_MAINFRAME 128

#define IDC_BUTTON_CREATESUPERPIXELS 1000

#define IDC_EDIT_SPCOUNT 1001

#define IDC_EDIT2 1002

#define IDC_EDIT_COMPACTNESS 1002

// Next default values for new objects

//

#ifdef APSTUDIO_INVOKED

#ifndef APSTUDIO_READONLY_SYMBOLS

#define _APS_NEXT_RESOURCE_VALUE 129

#define _APS_NEXT_COMMAND_VALUE 32771

#define _APS_NEXT_CONTROL_VALUE 1003

#define _APS_NEXT_SYMED_VALUE 101

#endif

#endif

Stdafx.h

// stdafx.h : include file for standard system include files,

// or project specific include files that are used frequently,

// but are changed infrequently

#pragma once

#ifndef _SECURE_ATL

#define _SECURE_ATL 1

#endif

#ifndef VC_EXTRALEAN

#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif

#include"targetver.h"

#define_ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit

// turns off MFC's hiding of some common and often safely ignored warning messages

#define _AFX_ALL_WARNINGS

#include// MFC core and standard components

#include// MFC extensions

#ifndef _AFX_NO_OLE_SUPPORT

#include// MFC support for Internet Explorer 4 Common Controls

#endif

#ifndef _AFX_NO_AFXCMN_SUPPORT

#include// MFC support for Windows Common Controls

#endif// _AFX_NO_AFXCMN_SUPPORT

#include// MFC support for ribbons and control bars

SLIC.h

// SLIC.h: interface for the SLIC class.

//===========================================================================

// This code implements the superpixel method described in:

//

// Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Susstrunk,

// "SLIC Superpixels",

// EPFL Technical Report no. 149300, June 2010.

//===========================================================================

// Copyright (c) 2012 Radhakrishna Achanta [EPFL]. All rights reserved.

//===========================================================================

//////////////////////////////////////////////////////////////////////

#if !defined(_SLIC_H_INCLUDED_)

#define _SLIC_H_INCLUDED_

#include

#include

#include

using namespace std;

class SLIC

{

public:

SLIC();

virtual ~SLIC();

//============================================================================

// Superpixel segmentation for a given step size (superpixel size ~= step*step)

//============================================================================ void DoSuperpixelSegmentation_ForGivenSuperpixelSize(

const unsigned int* ubuff,//Each 32 bit unsigned int contains ARGB pixel values.

const int width,

const int height,

int*& klabels,

int& numlabels,

const int& superpixelsize,

const double& compactness);

//============================================================================

// Superpixel segmentation for a given number of superpixels

//============================================================================ void DoSuperpixelSegmentation_ForGivenNumberOfSuperpixels(

const unsigned int* ubuff,

const int width,

const int height,

int*& klabels,

int& numlabels,

const int& K,//required number of superpixels

const double& compactness);//10-20 is a good value for CIELAB space

//============================================================================

// Supervoxel segmentation for a given step size (supervoxel size ~= step*step*step) //============================================================================

void DoSupervoxelSegmentation(

unsigned int**& ubuffvec,

相关文档
最新文档