资源简介
频域外推EC的matlab代码,对应的文章是Spatial Error Concealment of Corrupted Image Data using Frequency Selective Extrapolation
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Copyright (c) 2007 by %
% Chair of Multimedia Communications and Signal Processing %
% University of Erlangen-Nuremberg %
% - all rights reserved - %
% %
% This program is free of charge for scientific and personal %
% use. The author (Chair of Multimedia Communications and %
% Signal Processing University of Erlangen-Nuremberg) does %
% NOT give up his copyright. Any commercial use is prohibited %
% %
% YOU ARE USING THIS PROGRAM AT YOUR OWN RISK! THE AUTHOR %
% IS NOT RESPONSIBLE FOR ANY DAMAGE OR DATA-LOSS CAUSED BY THE %
% USE OF THIS PROGRAM. %
% %
% %
% If you have any questions please contact: %
% %
% Dipl.-Ing. Juergen Seiler %
% Multimedia Communications and Signal Processing %
% University of Erlangen-Nuremberg %
% Cauerstr. 7 %
% 91058 Erlangen Germany %
% %
% email: seiler @ lnt . de %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all;
clear all;
% Simulation parameters
src_img = double(imread(‘lena_y.tif‘));
border_width = 16;
dEa_threshold = 0;
Ea_threshold = 0;
fft_size = 64;
max_iter = 20;
rho = 0.8;
x_block_size = 16;
y_block_size = 16;
% Setup calculations
y_size = size(src_img1);
x_size = size(src_img2);
M = y_block_size+2*border_width;
N = x_block_size+2*border_width;
fft_x_offset = floor((fft_size-N)/2);
fft_y_offset = floor((fft_size-M)/2);
dE_a= zeros(fft_size);
% Show original image
figure(1)
imshow(src_img [0 255])
title(‘Original image‘)
% Generate erroneous image
y_loss_offset = 49:48:y_size-48;
x_loss_offset = 49:48:x_size-48;
loss_img = src_img;
for y_loss_counter = 1:length(y_loss_offset)
for x_loss_counter = 1:length(x_loss_offset)
loss_img(y_loss_offset(y_loss_counter)+(1:y_block_size)x_loss_offset(x_loss_counter)+(1:x_block_size)) = 0;
end
end
% Show erroneous image
figure(2)
imshow(loss_img [0 255])
title(‘Image with isolated block losses‘)
% Weighting function
w = zeros(fft_size);
w(fft_y_offset+(1:M) fft_x_offset+(1:N)) =
评论
共有 条评论