图割论文大合集下载:

http://download.csdn.net/detail/wangyaninglm/8292305

代码:

/* graph.h */
/* Vladimir Kolmogorov (vnk@cs.cornell.edu), 2001. */ /*
This software library is a modification of the maxflow algorithm
described in An Experimental Comparison of Min-Cut/Max-Flow Algorithms
for Energy Minimization in Computer Vision.
Yuri Boykov and Vladimir Kolmogorov.
In Third International Workshop on Energy Minimization
Methods in Computer Vision and Pattern Recognition, September 2001 This algorithm was originally developed at Siemens.
The main modification is that two trees are used for finding
augmenting paths - one grows from the source and the other
from the sink. (The original algorithm used only the former one).
Details will be described in my PhD thesis. This implementation uses an adjacency list graph representation.邻接链表
Memory allocation:
Nodes: 22 bytes + one field to hold a residual capacity
of t-links (by default it is 'short' - 2 bytes)
Arcs: 12 bytes + one field to hold a residual capacity 剩余容量
(by default it is 'short' - 2 bytes)
(Note that arcs are always added in pairs (弧都是成对的添加)- in forward and reverse directions) Example usage (computes a maxflow on the following graph): SOURCE
/ \
1/ \2
/ 3 \
node0 -----> node1
| <----- |
| 4 |
\ /
5\ /6
\ /
SINK /////////////////////////////////////////////////// #include <stdio.h>
#include "graph.h" void test_maxflow()
{
Graph::node_id nodes[2];
Graph *g = new Graph(); nodes[0] = g -> add_node();
nodes[1] = g -> add_node();
g -> set_tweights(nodes[0], 1, 5);
g -> set_tweights(nodes[1], 2, 6);
g -> add_edge(nodes[0], nodes[1], 3, 4); Graph::flowtype flow = g -> maxflow(); printf("Flow = %d\n", flow);
printf("Minimum cut:\n");
if (g->what_segment(nodes[0]) == Graph::SOURCE)
printf("node0 is in the SOURCE set\n");
else
printf("node0 is in the SINK set\n");
if (g->what_segment(nodes[1]) == Graph::SOURCE)
printf("node1 is in the SOURCE set\n");
else
printf("node1 is in the SINK set\n"); delete g;
} ///////////////////////////////////////////////////
*/

void test_maxflow()
{
Graph::node_id nodes[2];
Graph *g = new Graph(); nodes[0] = g -> add_node();
nodes[1] = g -> add_node();
g -> set_tweights(nodes[0], 3, 3);
g -> set_tweights(nodes[1], 3, 1);
g -> add_edge(nodes[0], nodes[1], 1, 0); Graph::flowtype flow = g -> maxflow(); printf("Flow = %d\n", flow);
printf("Minimum cut:\n");
if (g->what_segment(nodes[0]) == Graph::SOURCE)
printf("node0 is in the SOURCE set\n");
else
printf("node0 is in the SINK set\n");
if (g->what_segment(nodes[1]) == Graph::SOURCE)
printf("node1 is in the SOURCE set\n");
else
printf("node1 is in the SINK set\n"); delete g;
}

这块主要就是要理解,什么是maxflow,以及节点最后分割的类型是SOURCE还是SINK分别意味着什么

graphcuts算法时间复杂度与其他最大流算法的比较:

添加几篇文章地址:

graphcuts资料博客大合集

http://vision.csd.uwo.ca/code/

http://lincccc.blogspot.tw/2011/04/graph-cut-and-its-application-in.html

http://blog.csdn.net/zouxy09/article/details/8532106

http://lincccc.blogspot.tw/2011/03/cuda-cuts-fast-graph-cuts-on-gpu_03.html

http://blog.csdn.net/hebby06/article/details/5341228

GraphCuts算法解析,Graphcuts算法求最大流,最小割实例的更多相关文章

  1. 最大流&最小割 - 专题练习

    [例1][hdu5889] - 算法结合(BFS+Dinic) 题意 \(N\)个点\(M\)条路径,每条路径长度为\(1\),敌人从\(M\)节点点要进攻\(1\)节点,敌人总是选择最优路径即最短路 ...

  2. 最大流-最小割 MAXFLOW-MINCUT ISAP

    简单的叙述就不必了. 对于一个图,我们要找最大流,对于基于增广路径的算法,首先必须要建立反向边. 反向边的正确性: 我努力查找了许多资料,都没有找到理论上关于反向边正确性的证明. 但事实上,我们不难理 ...

  3. 网络流 最大流—最小割 之SAP算法 详解

    首先引入几个新名词: 1.距离标号: 所谓距离标号 ,就是某个点到汇点的最少的弧的数量(即边权值为1时某个点到汇点的最短路径长度). 设点i的标号为level[i],那么如果将满足level[i]=l ...

  4. 【UVA1515 算法竞赛入门指南】 水塘【最小割】

    题意: 输入一个h行w列的字符矩阵,草地用“#”表示,洞用"."表示.你可以把草改成洞,每格花费为d,也可以把洞填上草,每格花费为f.最后还需要在草和洞之间修围栏,每条边花费为b. ...

  5. matlab练习程序(最大流/最小割)

    学习这个算法是为学习图像处理中的图割算法做准备的. 基本概念: 1.最大流是一个有向图. 2.一个流是最大流,当且仅当它的残余网络中不包括增广路径. 3.最小割就是网络中所有割中值最小的那个割,最小割 ...

  6. 「网络流24题」「LuoguP2774」方格取数问题(最大流 最小割

    Description 在一个有 m*n 个方格的棋盘中,每个方格中有一个正整数.现要从方格中取数,使任意 2 个数所在方格没有公共边,且取出的数的总和最大.试设计一个满足要求的取数算法.对于给定的方 ...

  7. UVa11248 Frequency Hopping(最大流+最小割)

    题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=33206 [思路] 最大流最小割. 可以确定的是如果不可行需要修改的 ...

  8. HDU6582 Path【优先队列优化最短路 + dinic最大流 == 最小割】

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6582 来源:2019 Multi-University Training Contest 1 题目大意 ...

  9. 最大流&最小割&费用流模版

    好久都没有搞博客了.想认真写又要准备文化课期末了. ISAP 流程: 原理就是dfs找增广路. 最基础的建反向边以便反悔就不说了. 但是记录一个dep(dis)表示层数,一开始BFS(从t开始,dis ...

随机推荐

  1. android 网络获取json并且显示(2)

    1.将要的取得的json数据格式如下: 我们封装之前的类用google提供的JSONArray和JSONObject类对json字符串进行解析. 对于姚明显示每一条数据,我们封装了一个类如下: pub ...

  2. UNIX网络编程——揭开网络编程常见API的面纱【下】

    Linux网络编程数据收发的API流程分析        只要把数据在协议栈中的流动线路和脉络弄清楚了,关于协议栈的实现部分,理解起来就轻松多了.在网络编程章节的数据接收过程中,我们主要介绍过read ...

  3. Cocos2D中节点Z序的计算规则

    大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请多提意见,如果觉得不错请多多支持点赞.谢谢! hopy ;) 免责申明:本博客提供的所有翻译文章原稿均来自互联网,仅供学习交 ...

  4. 福利:工作经常用到的Mac软件整理(全)

    每日更新关注:http://weibo.com/hanjunqiang  新浪微博!iOS开发者交流QQ群: 446310206 前言 这是我个人在工作中会用到的Mac软件,其中包括办公.开发.视频等 ...

  5. javascript之页面打印

    WebBrowser组件是IE内置的浏览器控件,使用时,首先要在<body>标签的下面用<object>...</object>标记声明WebBrowser组件,代 ...

  6. Android必知必会-Stetho调试工具

    一.背景 Stetho是 Facebook 出品的一个强大的 Android 调试工具,使用该工具你可以在 Chrome Developer Tools查看APP的布局, 网络请求(仅限使用Volle ...

  7. Ruby开发入门

    开发环境搭建 首先安装Ruby SDK,我安装的版本是2.0.之后安装IDE,这里用的是Jetbrain的RubyMine 5.4.3,注意是否支持对应版本的Ruby SDK. 一段神奇的注册码... ...

  8. 学习Tensorflow,使用源码安装

    PC上装好Ubuntu系统,我们一步一步来讲解如何使用源码安装tensorflow?(我的Ubuntu系统是15.10) 安装cuda 根据你的系统型号选择相应的cuda版本下载 https://de ...

  9. (NO.00004)iOS实现打砖块游戏(六):反弹棒类

    大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请告诉我,如果觉得不错请多多支持点赞.谢谢! hopy ;) 打砖块游戏另一个要素是反弹棒,我们在这篇类来实现反弹棒类. 创建 ...

  10. 关于APP界面布局设计的八种优缺点

    学习UI设计的时候,经常要接触到页面的布局,布局的方式会直接影响一个APP的视觉效果,好的布局方式,往往能带来舒服的视觉效果,更能得到用户的接受与好评.然而万变不离其宗,移动端页面常用的布局,不外乎以 ...