有点懒了,准备把以前做的ppt直接截图放上来。。。就不一点点打了
值得注意的是这个cost方程,也叫能量方程,是由基于马尔科夫随机场的最大后验概率确定的区域项和边界项,不是随便设立的,参考文献:Exact maximum a posteriori estimation for binary images。
这张图表介绍的是graphcut的各种边的权重。
一个cut所包含的边,属于cut的边的权重的和就是cost方程的值。
graphcut的实际结果。graphcut的参考文献:Interactive Graph Cuts for Optimal Boundary & Region Segmentation of Objects in N-D Images
下面就是grabcut:
这里是grabcut和graphcut的区别。
这里是grabcut的具体工作流程,循环直到分割结果没有太大变化为止grabcut的不同迭代次数对结果的影响,grabcut的参考文献:“GrabCut” - Interactive Foreground Extraction using Iterated Graph Cuts
grabcut代码如下(需要配置opencv环境):
#include "stdafx.h"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
using namespace std;
using namespace cv;
static void help()
{
cout << "\nThis program demonstrates GrabCut segmentation -- select an object in a