diff options
Diffstat (limited to 'SD-VBS/common/toolbox/MultiNcut/MNcutDemo.m')
-rwxr-xr-x | SD-VBS/common/toolbox/MultiNcut/MNcutDemo.m | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/MultiNcut/MNcutDemo.m b/SD-VBS/common/toolbox/MultiNcut/MNcutDemo.m new file mode 100755 index 0000000..972a4eb --- /dev/null +++ b/SD-VBS/common/toolbox/MultiNcut/MNcutDemo.m | |||
@@ -0,0 +1,34 @@ | |||
1 | % MNcutDemo.m | ||
2 | % created by song, 06/13/2005 | ||
3 | % an exmaple of how to use and display MNcut | ||
4 | |||
5 | num_segs = [20]; | ||
6 | imageSize = 800; | ||
7 | |||
8 | img_filename = '/u/ikkjin/Benchmark/stitch/data/test/capitol/img1.jpg'; | ||
9 | |||
10 | I=readimage(img_filename,imageSize); | ||
11 | |||
12 | [SegLabel,eigenVectors,eigenValues]= MNcut(I,num_segs); | ||
13 | |||
14 | for j=1:size(SegLabel,3), | ||
15 | [gx,gy] = gradient(SegLabel(:,:,j)); | ||
16 | bw = (abs(gx)>0.1) + (abs(gy) > 0.1); | ||
17 | |||
18 | figure(1);clf; J1=showmask(double(I),bw); imagesc(J1);axis image; axis off; | ||
19 | set(gca, 'Position', [0 0 1 1]); | ||
20 | |||
21 | % cm = sprintf('print -djpeg %s/file%.4d-%.2d.jpg',OutputDir,id,num_segs(j)); disp(cm);eval(cm); | ||
22 | |||
23 | |||
24 | % figure(10);imagesc(SegLabel(:,:,j));axis image; axis off; | ||
25 | % set(gca, 'Position', [0 0 1 1]); | ||
26 | % cm = sprintf('print -djpeg %s/Seg%.4d-%.2d.jpg',OutputDir,id,num_segs(j));disp(cm);eval(cm); | ||
27 | |||
28 | % pause; | ||
29 | end | ||
30 | |||
31 | % fname = files(id).name; | ||
32 | %cm = sprintf('save %s/SegLabl%.4d.mat I SegLabel fname',OutputDir,id); disp(cm); eval(cm); | ||
33 | %cm = sprintf('save %s/SegEig%.4d.mat eigenVectors eigenValues',OutputDir,id);disp(cm); eval(cm); | ||
34 | |||