-
大小: 773KB文件類型: .rar金幣: 2下載: 0 次發布日期: 2021-05-25
- 語言: C/C++
- 標簽: SLIC??Superpixels??C++代碼??
資源簡介
生成的超像素如同細胞一般緊湊整齊,鄰域特征比較容易表達。這樣基于像素的方法可以比較容易的改造為基于超像素的方法。不僅可以分割彩色圖,也可以兼容分割灰度圖。需要設置的參數非常少,默認情況下只需要設置一個預分割的超像素的數量。
相比其他的超像素分割方法,SLIC在運行速度、生成超像素的緊湊度、輪廓保持方面都比較理想。

代碼片段和文件信息
//=================================================================================
//=================================================================================
//
//?PictureHandler.cpp:?implementation?of?the?PictureHandler?class.
//
//===========================================================================
//?Copyright?(c)?2013?Radhakrishna?Achanta.
//
//?For?commercial?use?please?contact?the?author:
//
//?Email:?firstname.lastname@epfl.ch
//===========================================================================
#include?“stdafx.h“
#include?“PictureHandler.h“
#include???
//=================================================================================
//?Construction/Destruction
//=================================================================================
PictureHandler::PictureHandler()
{
StartUpGdiPlus();
}
PictureHandler::~PictureHandler()
{
ShutDownGdiPlus();
}
//=================================================================================
// StartUpGdiPlus()
//
// Starts?up?GdiPlus.?Can?also?be?used?for?other?things?like?memory?allocation.
//=================================================================================
void?PictureHandler::StartUpGdiPlus()
{
m_gdiplusStartupInput?=?new?GdiplusStartupInput();
Status?stat?=?GdiplusStartup(&m_gdiplusToken?m_gdiplusStartupInput?NULL);
_ASSERT(?stat?==?Ok?);
}
//=================================================================================
// ShutDownGdiPlus()
//
// Shuts?down?GdiPlus.?Can?also?be?used?for?other?things?like?memory?deallocation.
//=================================================================================
void?PictureHandler::ShutDownGdiPlus()
{
if?(m_gdiplusToken?!=?NULL)
{
GdiplusShutdown(m_gdiplusToken);
delete?m_gdiplusStartupInput;
m_gdiplusStartupInput?=?NULL;
m_gdiplusToken?=?NULL;
}
}
//=================================================================================
// GetEncoderClsid()
//
// The?encoder?CLSID?provided?depends?on?the?format?string?provided;
// L“image/jpeg“?for?JPEG?CLSID?and?L“image/bmp“?for?BMP?CLSID
//=================================================================================
int?PictureHandler::GetEncoderClsid(const?WCHAR*?format?CLSID*?pClsid)
{
???UINT??num?=?0;??????????//?number?of?image?encoders
???UINT??size?=?0;?????????//?size?of?the?image?encoder?array?in?bytes
???ImageCodecInfo*?pImageCodecInfo?=?NULL;
???GetImageEncodersSize(&num?&size);
???if(size?==?0)
??????return?-1;??//?Failure
???pImageCodecInfo?=?(ImageCodecInfo*)(malloc(size));
???if(pImageCodecInfo?==?NULL)
??????return?-1;??//?Failure
???GetImageEncoders(num?size?pImageCodecInfo);
???for(UINT?j?=?0;?j????{
??????if(?wcscmp(pImageCodecInfo[j].MimeType?format)?==?0?)
??????{
?????????*pClsid?=?pImageCodecInfo[j].Clsid;
?????????free(pImageCodecInfo);
?????????return?j;??//?Success
??????}????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????1771520??2013-11-19?16:00??SLICSuperpixels\Release\SLICSuperpixels.exe
?????文件??????10078??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\PictureHandler.cpp
?????文件???????2538??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\PictureHandler.h
?????文件???????3460??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\ReadMe.txt
?????文件??????67777??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\res\SLICSuperpixels.ico
?????文件????????406??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\res\SLICSuperpixels.rc2
?????文件????????687??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\resource.h
?????文件??????26606??2013-11-19?16:05??SLICSuperpixels\SLICSuperpixels\SLIC.cpp
?????文件???????7758??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\SLIC.h
?????文件???????1717??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\SLICSuperpixels.cpp
?????文件????????562??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\SLICSuperpixels.h
?????文件???????4720??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\SLICSuperpixels.rc
?????文件???????5842??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\SLICSuperpixels.vcproj
?????文件???????1433??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\SLICSuperpixels.vcproj.LENOVO-73CDB26E.RK.user
?????文件???????7029??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\SLICSuperpixelsDlg.cpp
?????文件????????961??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\SLICSuperpixelsDlg.h
?????文件????????217??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\stdafx.cpp
?????文件???????1075??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\stdafx.h
?????文件???????1432??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\targetver.h
?????文件????????911??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels.sln
?????文件???????3124??2013-11-19?16:00??SLICSuperpixels\USAGE_SLIC.txt
?????文件?????????90??2018-05-15?18:30??SLICSuperpixels\運行提示.txt
?????目錄??????????0??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels\res
?????目錄??????????0??2013-11-19?16:00??SLICSuperpixels\Release
?????目錄??????????0??2013-11-19?16:00??SLICSuperpixels\SLICSuperpixels
?????目錄??????????0??2018-05-15?18:28??SLICSuperpixels
-----------?---------??----------?-----??----
??????????????1919943????????????????????26
- 上一篇:信道編碼的C語言程序
- 下一篇:用c語言編程ftp程序,并實現基本功能
評論
共有 條評論