📄 test_structure_texture_decomposition.m
字号:
% test for TV-L2 (Osher-Rudin-Fatemi) decomposition% and TV-Gabor (Aujol-Gilboa) decompositionn = 128;path(path, 'toolbox/');name = 'barb';% to save resultsrep = ['results/separation/' name '/'];if not(exist(rep)) mkdir(rep);endif strcmp(name, 'barb') n0 = [];else n0 = n;endM = load_image(name, n0);M = rescale( sum( crop(M,n),3) );%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TV-L2 decompositionoptions.dt = 0.1249;lam = 1/20 * 215/max(M(:));options.niter = 300;options.use_gabor = -1; % 1:TV-Hilbert, -1:TV-L2lam = 1/50 * 215/max(M(:));options.p0x = []; options.p0y = [];disp('--> Performing TV-L2 decomposition.');options.p0x = []; options.p0y = [];[u0,v0,options.p0x,options.p0y] = perform_tv_hilbert_projection(M,[],lam,options);clf;imageplot(u0,'cartoon part',1,2,1);imageplot(v0,'textured part', 1,2,2);warning off;imwrite( clamp(M), [rep name '-original.png'] );imwrite( clamp(u0), [rep name '-tvl2-structure.png'] );imwrite( rescale(v0), [rep name '-tvl2-texture.png'] );warning off;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TV-Gabor decompositionlam = 0.005 * 215/max(M(:)); %parameter for TV-Hilbertoptions.niter = 1000; % number of iterations for TV-Hilbertoptions.dt=0.001; %step time for TV-Hilbertoptions.use_gabor = 1; % 1:TV-Hilbert, -1:TV-L2disp('--> Performing TV-Gabor decomposition.');[u0,v0,options.p0x,options.p0y] = perform_tv_hilbert_projection(M,@compute_local_fourier_operator,lam,options);clf;imageplot(u0,'cartoon part',1,2,1);imageplot(v0,'textured part', 1,2,2);warning off;imwrite( clamp(u0), [rep name '-tvk2-structure.png'] );imwrite( rescale(v0), [rep name '-tvk2-texture.png'] );warning off;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -