⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch8_4_3.m

📁 约束最小二乘滤波复原 用真实的PSF函数和噪声强度作为参数进行图像复原 另一程序 盲卷积滤波复原 图像模糊化
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%约束最小二乘滤波复原
%用真实的PSF函数和噪声强度作为参数进行图像复原
NP = V*prod(size(I)); % noise power
reg1 = deconvreg(BlurredNoisy1,PSF1,NP);
reg2 = deconvreg(BlurredNoisy2,PSF2,NP);
figure;
subplot(1,2,1);imshow(reg1);
title('Restored1 with NP');
subplot(1,2,2);imshow(reg2);
title('Restored2 with NP');

%调用edgetaper函数,减弱噪声放大效应和振铃现象
Edged1 = edgetaper(BlurredNoisy1,PSF1);
Edged2 = edgetaper(BlurredNoisy2,PSF2);
reg7 = deconvreg(Edged1,PSF1,NP/1.3);
reg8 = deconvreg(Edged2,PSF2,NP/1.3);
figure;
subplot(1,2,1);imshow(reg7);
title('Edgetaper effect1');
subplot(1,2,2);imshow(reg8);
title('Edgetaper effect2');

%已知相应的拉格朗日算子LARGA
[reg1 LAGRA] = deconvreg(BlurredNoisy1,PSF1,NP);
reg9 = deconvreg(Edged1,PSF1,[],LAGRA);
reg10 = deconvreg(Edged1,PSF1,[],LAGRA*100);
reg11 = deconvreg(Edged1,PSF1,[],LAGRA/100);
figure;
subplot(1,3,1);imshow(reg9);
title('true LAGRA');
subplot(1,3,2);imshow(reg10);
title('large LAGRA');
subplot(1,3,3);imshow(reg11);
title('small LAGRA');

另一程序

%%%%%%%%%%%%%%%%%%%% 盲卷积滤波复原
%图像模糊化
I = imread('cameraman.tif');
figure;imshow(I);title('Original Image');
PSF = fspecial('motion',13,45);
figure; imshow(PSF,[],'notruesize');
Blurred = imfilter(I,PSF,'circ','conv');
figure; imshow(Blurred); title('Blurred Image');

%图像复原
INITPSF = ones(size(PSF));%获取函数的特征
[J P]= deconvblind(Blurred,INITPSF,30);%盲卷积,保留使用的PSF
figure; imshow(J);
figure; imshow(P,[],'notruesize');

WEIGHT = edge(I,'sobel',.28);%sobel算子提取边缘
se1 = strel('disk',1);
se2 = strel('line',13,45);
WEIGHT = ~imdilate(WEIGHT,[se1 se2]);%膨胀操作,边界像素设为零
WEIGHT = padarray(WEIGHT(2:end-1,2:end-1),[2 2]);
figure; imshow(WEIGHT);

P1 = P;%保存数据
P1(find(P1 < 0.01))=0;%修改PSF函数
%利用上面得到的WEIGHT进行盲卷积
[J2 P2] = deconvblind(Blurred,P1,50,[],WEIGHT); 
figure; imshow(J2);
figure; imshow(P2,[],'notruesize');


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -