graph cut

graph cut

2013年10月10日 ⁄ 綜合 ⁄ 共 3584字 ⁄ 字號    ⁄ 評論關閉

1、http://www.cs.cmu.edu/~mohitg/segmentation.htm

 

Interactive Segmentation Tool-Box

An implementation of ‘Lazy Snapping’ and ‘GrabCut’: Based on Interactive Graph Cuts

Lazy Snapping [2] and GrabCut [3] are 2D image segmentation tools based on the interactive graph-cuts technique proposed by Boykov and Jolly [1]. Lazy Snapping requires the user to specify foreground and background seeds, and performs 2D segmentation with
the seeds as hard constraints. GrabCut makes the process more automatic by using iterated graph cuts – the only user interaction required is a bounding box of the foreground object.

We provide an implementation of both these tools, along with a third tool which combines both these methods. Our code uses themaxflow code [4]by Vladimimr Kolmogorov.

    



 

Source Code

SegTool.zip

Requires MATLAB and mex (C++) compiler. You will need kmeans on MATLAB to run the code. Refer the README file for compilation instructions.



 

PASCAL Data-Set

 

 

Our Segmentation Tool can be used to perform segmentation on huge image databases. As an example, we provideresults of using the Grab Cut Tool on a subset of the PASCAL
data set [5] (a few different Object Classes). We use the Bounding Boxes available along with this set to seed our iterative graph cuts algorithm. The parameters given in the parameter file can be fine-tuned to achieve desirable segmentations.

Note: The coarseness around the boundary of the segmented results is due to the fact that the code runs segmentation on water-shedsuper-pixels instead of pixels, for efficiency purposes. Using super-pixels, we achieve a
significant speed-up at the cost of slight loss of accuracy.



 

References

[1] Interactive Graph Cuts for Optimal Boundary & Region Segmentation of Objects in N-D Images.Boykov & Jolly, ICCV 2001   [PDF]

[2] Lazy Snapping. Yin Li, Jian Sun, Chi-Keung Tang, Heung-Yeung Shum, SIGGRAPH 2004                                                                [PDF]

[3] GrabCut — Interactive Foreground Extraction using Iterated Graph Cuts.Rother, Kolmogorov & Blake, SIGGRAPH 2004     [PDF]

[4] http://www.adastral.ucl.ac.uk/~vladkolm/software.html

[5] 
http://www.pascal-network.org/challenges/VOC/voc2005/index.html

 /***********************************************************/

代碼測試結果win7 64bit+matlab 2012a+vs2010 編譯通不過,沒細研究

                      win7 64bit/32bit+matlab 2012a+vs2008編譯沒問題,程序運行結果異常終止

                      winxp+matlab7.1+vc6.0編譯沒問題,運行時matlab報錯: too many input arguments,可能和版本有關,data.ui.push_bg = uicontrol(hfig, 'Style','pushbutton', 'Units', 'Normalized','Position',[.7 .4 .1 .05], ...
    'String','Graph Cuts','Callback', ['Segment ',longfilename]);

其中:longfilename = strcat(pathname,filename);  longfilename由絕對路徑和文件名組成,改成相對路徑就不會報錯了

longfilename = strcat('images\',filename);

測試了兩幅圖片,一張是原圖,一張是標記了前景和背景的圖片,測試代碼如下:

global sopt fgpixels bgpixels;
sopt = mksopt;

img_name='images\kid2.bmp';
scribs_img_name='images\kid2_m.bmp';

I=double(imread(img_name))/255;
mI=double(imread(scribs_img_name))/255;
consts_map=sum(abs(I-mI),3)>0.001;
if (size(I,3)==3)
  consts_vals=rgb2gray(mI).*consts_map;
end
if (size(I,3)==1)
  consts_vals=mI.*consts_map;
end


fgpixels=[];
[fgpixels(:,2),fgpixels(:,1)]=find(consts_vals>0);
bg=consts_map-consts_vals;
bgpixels=[];
[bgpixels(:,2),bgpixels(:,1)]=find(bg>0);


Segment('images\kid2.bmp');

測試結果可以對圖像進行摳圖,由於是01年的文章,摳圖效果肯定沒有現在的matting算法效果好

 

 

2、http://masterravi.wordpress.com/2011/05/24/interactive-segmentation-using-graph-cutsmatlab-code/

 

3、http://cs.brown.edu/~pff/segment/

 

4、http://research.microsoft.com/en-us/um/cambridge/projects/visionimagevideoediting/segmentation/grabcut.htm

 

5、http://www.360doc.com/content/11/0426/21/6408986_112560226.shtml

 

6、https://mywebspace.wisc.edu/pwang6/personal/

 

7、http://research.microsoft.com/en-us/um/cambridge/projects/visionimagevideoediting/segmentation/grabcut.htm

 

8、https://developer.nvidia.com/content/graphcuts-using-npp

 

9、http://docs.nvidia.com/cuda/cuda-samples/index.html

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章