资源简介
图像分割代码,作者V. Lempitsky, A. Blake, C. Rother. Image Segmentation by Branch-and-Mincut.
In proceedings of European Conference on Computer Vision (ECCV), October 2008.

代码片段和文件信息
/*
This software contains the C++ implementation of the “branch-and-mincut“ framework for image segmentation
with various high-level priors as described in the paper:
V. Lempitsky A. Blake C. Rother. Image Segmentation by Branch-and-Mincut.
In proceedings of European Conference on Computer Vision (ECCV) October 2008.
The software contains the core algorithm and an example of its application (globally-optimal
segmentations under Chan-Vese functional).
Implemented by Victor Lempitsky 2008
*/
#include “BranchAndMincut.h“
#include
#include
#include
//using stl for the queue in the min
#include
#include
#include
#include
//////////////////////////////////
int imWidth = 0;
int imHeight = 0;
static int *bestSegm;
static Branch *bestBranch = NULL;
static gtype upperBound; //best leaf energy found so far
//////////////////////////////////////////////
static int statFlowCalls; //counting calls to lower bound/energy evaluations
//////////////////////////////////////////////
struct
{
GraphT *graph;
gtype *bgUnaries;
gtype *fgUnaries;
bool maxflowWasCalled;
void Reset(gtype *pairwise gtype *commonUnaries)
{
maxflowWasCalled = false;
graph->reset();
graph->add_node(imWidth*imHeight);
int xyi;
if(commonUnaries)
for(i = 0; i < imWidth*imHeight; i++)
{
if(commonUnaries[i] > 0)
graph->add_tweights(i commonUnaries[i] 0);
else
graph->add_tweights(i 0 -commonUnaries[i]);
}
for(y = 0 i = 0; y < imHeight; y++)
for(x = 0; x < imWidth; x++ i++)
{
if(y && x < imWidth-1) graph->add_edge(i i-imWidth+1 pairwise[i*4] pairwise[i*4]);
if(x < imWidth-1) graph->add_edge(i i+1 pairwise[i*4+1] pairwise[i*4+1]);
if(y < imHeight-1 && x < imWidth-1) graph->add_edge(i i+imWidth+1 pairwise[i*4+2] pairwise[i*4+2]);
if(y < imHeight-1) graph->add_edge(i i+imWidth pairwise[i*4+3] pairwise[i*4+3]);
}
memset(fgUnaries 0 sizeof(gtype)*imWidth*imHeight);
memset(bgUnaries 0 sizeof(gtype)*imWidth*imHeight);
}
} reusable;
void PrepareGraph(int imwidth int imheight)
{
imWidth = imwidth;
imHeight = imheight;
reusable.graph = new GraphT(imwidth*imheight imwidth*imheight*4);
reusable.bgUnaries = new gtype[imwidth*imheight];
reusable.fgUnaries = new gtype[imwidth*imheight];
}
void ReleaseGraph()
{
delete reusable.graph;
delete reusable.bgUnaries;
delete reusable.fgUnaries;
}
//////////////////////////////////////////
//STL stuff
struct BranchWrapper
{
Branch *br;
BranchWrapper(Branch *b): br(b) {}
};
using namespace std;
bool operator<(const BranchWrapper& a const BranchWrapper& b)
{
return a.br->bound < b.br->bound;
}
bool operator>(const BranchWrapper& a const BranchWrapper& b)
{
return a.br->bound > b.br->bound;
}
typedef std::priority_queue
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7332 2008-09-22 13:49 BranchAndMincut.cpp
文件 2961 2008-09-22 13:49 BranchAndMincut.h
文件 4027 2008-09-22 14:27 ChanVeseSegmentation.cpp
文件 1931 2008-09-22 13:49 ChanVeseSegmentation.h
文件 59983 2008-09-22 14:23 lake.png
文件 3703 2008-09-22 13:52 ReadMe.txt
文件 6111 2008-11-13 17:02 license.txt
文件 3023 2009-10-14 16:03 image.h
文件 5385 2009-10-14 15:52 BranchAndMincut.vcproj
文件 894 2009-10-14 15:52 BranchAndMincut.sln
文件 7466 2006-11-07 18:56 Maxflow\block.h
文件 1166 2006-11-07 21:01 Maxflow\CHANGES.TXT
文件 3029 2006-11-16 20:16 Maxflow\graph.cpp
文件 17739 2009-10-14 14:27 Maxflow\graph.h
文件 410 2006-06-13 18:42 Maxflow\instances.inc
文件 15569 2006-11-16 20:16 Maxflow\maxflow.cpp
文件 4430 2009-10-14 14:12 Maxflow\README.TXT
- 上一篇:CAD文字提取工具
- 下一篇:shaderX1-7和GPU Pro1-5
相关资源
- bp神经网络源代码,可直接运行
- 随机森林R语言代码
- 计算机图形学 边填充算法实现代码
- 直流无刷电机方波驱动 stm32 例程代码
- 仿知乎界面小程序源代码
- 贪吃蛇源代码.fla
- 周立功开发板ProASIC3实验-syn_FIFO代码
- IMX385驱动代码.zip
- VisualStudioUninstaller vs卸载工具
- 组态王驱动开发包3.0.0.7(中文)
- 多窗口后台鼠标连点器
- dotnet 写字板 实验 源代码 不好请要不
- 使用选择性重传协议实现UDP可靠通信
- 图像二维小波变换的实现源代码
- 八三编码器设计 VHDL代码 简单,包附
- linux应用层的华容道游戏源代码
- 交通咨询模拟系统完整代码
- http请求状态代码
- 数值分析所有实验代码
- VC 获得文件属性 获取文件的创建时
- 网上拍卖系统完整源代码
- 音乐代码转换软件 单片机编程时用
- CSMA/CD等动画演示加源代码
- silicon lab公司的收音IC SI47XX全套开发工
- 读者写者问题(读者优先,写者优先
- 用51单片机实现G代码翻译
- 合同管理系统的源代码(附数据库)
- 用VC 编写的仿QQ聊天室程序源代码
- web班级网站设计代码
- 38k单片机红外发送代码、keil
评论
共有 条评论