function [I_result] = image_denoising_QAB(I,J,Ms,pds,sg)
%size of image
[M,M1] = size(I); % assume M = M2
MM = M^2;
N = 64;
NN = N^2;
P = 2*M/N;
% store initial data
I_old = I;
J_old = J;
saut = 12; %Moving the threshold (must be at least 1, this is the slowest case)
% Threshold parameter
Vs = linspace(7,11,Ms); % for reconstruction
Vs = 2 .^Vs;
disp('Start the search of wave function')
J_new = zeros(M,M); %creat space for the big image
o = 0;
cmpt = zeros(M,M); %count the overlapping
for i = 0:(P-2)
for j = 0:(P-2)
% These variables store the values associated with the maximums.
V_ms = 0.01;
RSB_ms = 0; % maximum SNR for adaptive transformation
seuil_ms = 1;
% Devide the image in to small parts
J_part = J((i*N/2+1):(i*N/2+N),(j*N/2+1):(j*N/2+N));
I_part = I((i*N/2+1):(i*N/2+N),(j*N/2+1):(j*N/2+N));
% Normalize small part
J_part_max = max(max(J_part));
I_part = I_part/J_part_max;
J_part = J_part/J_part_max;
pI_part = sum(sum(I_part .^2)) / NN;
% The noisy image is blurred
% Creation of a Gaussian
[x,y] = meshgrid((-N/2):(N/2 - 1));
z = 1 / (sqrt(2 * pi * sg))^2 * exp(-(x .^2 + y .^2) / (2 * sg));
% Convolution product
gaussF = fft2(ifftshift(z));
JF = fft2(J_part);
n_J = real(ifft2(gaussF .* JF));
% new images
Jns = zeros(N,N);
%Calculation of the eigenvectors then projection in the base
J_col = reshape(J_part,NN,1);
[psi,psi_col,E] = f_ondes2D(n_J,pds);
alp = linsolve(psi_col,J_col);
% Reconstruction des images
for k = 1:Ms %Loop on the slope parameter
v = Vs(k);
max_atteint = 0;
RSB_s = 0;
l = 1;
while (l <= NN) * (max_atteint < 20) %Loop on the threshold position, stops when one reaches a local maximum (global?) For the threshold parameter
% threshold
x = (1:(NN)) - l + 2;
taux = heavi(x,v);
%Re-construction
n_I = zeros(N,N);
for t = 1:(NN)
n_I = n_I + psi(:,:,t) * taux(t) * alp(t);
end
% Calculation of SNR
n_B = n_I - I_part;
pnB = sum(sum(n_B .^2)) / NN;
RSB_n = 10 * log10(pI_part / pnB);
% Test if the SNR increases
max_atteint = (max_atteint + 1) * (RSB_s > RSB_n);
RSB_s = RSB_s * (RSB_s > RSB_n) + RSB_n * (RSB_s <= RSB_n);
V_ms = V_ms * (RSB_ms >= RSB_n) + v * (RSB_ms < RSB_n);
seuil_ms = seuil_ms * (RSB_ms >= RSB_n) + l * (RSB_ms < RSB_n);
Jns = Jns * (RSB_ms >= RSB_n) + n_I * (RSB_ms < RSB_n);
RSB_ms = RSB_ms * (RSB_ms >= RSB_n) + RSB_n * (RSB_ms < RSB_n);
l = l + saut;
end
end
%store the small part into the big image
J_new((i*N/2+1):(i*N/2+N),(j*N/2+1):(j*N/2+N)) = Jns * J_part_max + J_new((i*N/2+1):(i*N/2+N),(j*N/2+1):(j*N/2+N));
cmpt((i*N/2+1):(i*N/2+N),(j*N/2+1):(j*N/2+N)) = cmpt((i*N/2+1):(i*N/2+N),(j*N/2+1):(j*N/2+N)) + 1;
o = o+1
end
end
J_new = J_new./cmpt; %remove the overlapping
I_result = J_new;
end
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
matlab_(含教程)基于量子自适应变换QAB算法的图像去噪matlab仿真.7z (8个子文件)
matlab_(含教程)基于量子自适应变换QAB算法的图像去噪matlab仿真
matlab
Lena.jpg 43KB
Runme.m 2KB
func
calc_PSNR.m 334B
f_ondes2D.m 2KB
image_denoising_QAB.m 3KB
heavi.m 239B
ssim_index.m 3KB
教程.mp4 46.78MB
共 8 条
- 1
资源评论
- 2301_774852052024-01-11资源不错,很实用,内容全面,介绍详细,很好用,谢谢分享。
mYlEaVeiSmVp
- 粉丝: 1961
- 资源: 19万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功