资源简介
关于非局部总变差的代码,适合做图像处理等问题。
代码片段和文件信息
clear all
close all
% set up cameram man example
I = double(imread(‘cameraman.tif‘));
H = fspecial(‘average‘9);
%H=fspecial(‘Gaussian‘212);
[MN]=size(I);
%% Add blur and noise
B = imfilter(IH‘circular‘);
sigma=3;
Bn = B+randn(MN)*sigma;
%% Pre-compute the weight by tikronov optimal reconstruction
[Im0 sigma1 lambdaerr] = tikronov_optimal_lambda(Bn H sigma);
% TV reconstruction
opts.bTol=0.99*sigma; % stop when ||Au-g||\leq btol*sigma for noise case
opts.Init=Im0;
opts.I=I;
opts.nWeightUpdate=0;
%%
time = cputime;
opts.type=1;
opts.mu=5; %
[uTV_bosenergyrelmsepsnr_n]=Decon_TV(BnHopts);
time=cputime-time;
%uTV=deconvrof(BnH11000.01);
%%
opts.h0=2*sigma1;
opts.nDenoising=20;
opts.type=1;
opts.mu=10; %
time_nltv_bos=cputime;
[uNLTV_bosenergyrelmsepsnr_n_nltv_bos]=Decon_NLTV(BnHopts);
time_nltv_bos=cputime-time_nltv_bos
%%
opts.type=2;
opts.mu=20;
opts.epsilon=0.1;
time_nltv_pbos=cputime;
[uNLTV_pbosenergyrelmsepsnr_n_nltv_pbos]=Decon_NLTV(BnHopts);
time_nltv_pbos=cputime-time_nltv_pbos
%%
time = cputime;
opts.type=1;
opts.mu=5;
[uNLH1_bosenergyrelmsepsnr_n]=Decon_NLH1(BnHopts);
time=cputime-time;
%%
opts.type=2;
opts.mu=10;
opts.epsilon=0.1;
opts.nWeightUpdate=0;
time = cputime;
[uNLH1_pbosenergyrelmsepsnr_n]=Decon_NLH1(BnHopts);
time=cputime-time;
%% Other comparison
u_GPSR=GPSR_decon(BnH[]);
%% gradient descent for nltv
time_gd=cputime;
w=nlmeans_weight_sym(Im0sigma1210);
[uNLTV_gdkenergyNLTVtime] = nonlocalTV_decon(BnHw15500Im0);
time_gd=cputime-time_gd
%%
figure
subplot(331)imshow(I[0 255 ])title(‘Original‘);
subplot(332)imshow(Bn[0 255 ])title(‘Blurry‘);
%subplot(333)imshow(Im0[0 255 ])title([‘Initial guess by setting unknown 0 PSNR=‘num2str(PSNR(IIm0))]);
subplot(333)imshow(uNLTV_gd[0 255 ])title([‘NLTV with Gradient descent PSNR=‘num2str(PSNR(IuNLTV_gd))]);
subplot(334)imshow(uTV_bos[0 255 ])title([‘TV PSNR=‘num2str(PSNR(IuTV_bos))]);
subplot(335)imshow(uNLH1_bos[0 255 ])title([‘NLH1 BOS PSNR=‘num2str(PSNR(IuNLH1_bos))]);
subplot(336)imshow(uNLH1_pbos[0 255 ])title([‘NLH1 PBOS PSNR=‘num2str(PSNR(IuNLH1_pbos))]);
subplot(337)imshow(uNLTV_bos[0 255 ])title([‘NLTV BOS PSNR=‘num2str(PSNR(IuNLTV_bos))]);
subplot(338)imshow(uNLTV_pbos[0 255 ])title([‘NLTV PBOS PSNR=‘num2str(PSNR(IuNLTV_pbos))]);
subplot(339)imshow(u_GPSR[0 255 ])title([‘GPSR PSNR=‘num2str(PSNR(Iu_GPSR))]);
%%
if 0
name=‘cameraman_deblur‘;
dir=‘\results‘;
gmin=0;
gmax=255;
image_name=[name‘_original.eps‘];
image2eps(Iimage_namedirgmingmax);
image_name=[name‘_blur.eps‘];
image2eps(Bnimage_namedirgmingmax);
image_name=[name‘_init.eps‘];
image2eps(Im0image_namedirgmingmax);
image_name=[name‘_tv.eps‘];
image2eps(uTV_bosimage_namedirgmingmax);
image_name=[name‘_nltv_bos.eps‘];
image2eps(uNLTV_bosimage_namedirgmingmax);
image_name=[name‘_nltv_pbos.eps‘];
image2eps(uNLTV_pbosimage_namedirgmingmax);
image_na
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 432086 2008-11-20 18:20 BOS_NLTV_v1\barbar_test.mat
文件 3410 2009-07-16 17:56 BOS_NLTV_v1\figure_1.m
文件 5276 2009-07-16 14:05 BOS_NLTV_v1\figure_2.m
文件 5381 2009-07-16 17:54 BOS_NLTV_v1\figure_3.m
文件 6148 2007-12-04 11:46 BOS_NLTV_v1\GPSR_5.0\.DS_Store
文件 65126 2007-01-25 13:54 BOS_NLTV_v1\GPSR_5.0\Camera.tif
文件 7046 2007-09-23 20:49 BOS_NLTV_v1\GPSR_5.0\demo_continuation.m
文件 5857 2008-11-21 22:51 BOS_NLTV_v1\GPSR_5.0\demo_image_deblur.asv
文件 5857 2008-11-21 22:54 BOS_NLTV_v1\GPSR_5.0\demo_image_deblur.m
文件 8489 2007-10-19 16:40 BOS_NLTV_v1\GPSR_5.0\figures_1_2_3.m
文件 5225 2007-09-12 18:21 BOS_NLTV_v1\GPSR_5.0\figure_4.m
文件 5276 2007-12-04 11:46 BOS_NLTV_v1\GPSR_5.0\figure_5.m
文件 2377 2007-07-12 18:41 BOS_NLTV_v1\GPSR_5.0\figure_6.m
文件 21851 2007-12-04 11:26 BOS_NLTV_v1\GPSR_5.0\GPSR_Basic.m
文件 21647 2007-12-04 11:08 BOS_NLTV_v1\GPSR_5.0\GPSR_BB.m
文件 12630 2007-09-06 15:10 BOS_NLTV_v1\GPSR_5.0\IST.m
文件 8569 2007-06-16 15:41 BOS_NLTV_v1\GPSR_5.0\l1_ls.m
文件 3178 2007-12-05 19:06 BOS_NLTV_v1\GPSR_5.0\README.txt
文件 43807 2009-02-28 15:36 BOS_NLTV_v1\images\barbara256.png
文件 65126 2007-01-25 13:54 BOS_NLTV_v1\images\Camera.tif
文件 76763 2008-08-15 14:26 BOS_NLTV_v1\images\patches.gif
..A.SH. 30720 2009-06-09 13:58 BOS_NLTV_v1\images\Thumbs.db
文件 17457 2009-07-16 15:00 BOS_NLTV_v1\mex\compute_nl_weights_mex.c
文件 12800 2009-07-16 14:53 BOS_NLTV_v1\mex\compute_nl_weights_mex.mexw32
文件 5160 2009-07-02 10:25 BOS_NLTV_v1\mex\NLH1_mex.c
文件 7168 2009-07-16 14:53 BOS_NLTV_v1\mex\NLH1_mex.mexw32
文件 4485 2008-09-02 15:38 BOS_NLTV_v1\mex\nlmeans_weight_sym.c
文件 7680 2009-07-16 14:53 BOS_NLTV_v1\mex\nlmeans_weight_sym.mexw32
文件 8713 2008-11-20 16:58 BOS_NLTV_v1\mex\SBNLTV_mex.c
文件 8704 2009-07-16 14:53 BOS_NLTV_v1\mex\SBNLTV_mex.mexw32
............此处省略77个文件信息
- 上一篇:QC浏览器_QCExplorer
- 下一篇:数据结构教程第三版—课后习题答案李春葆等
评论
共有 条评论