You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
477 B
Matlab

4 months ago
%function_1
function [B, psf] = sfoca(A)
% function [B, psf] = sfoca(A)
% In input:
% A, matrice dellimmagine da sfocare
% In output:
% B, matrice dellimmagine sfocata
% psf, matrice della PSF utilizzata
% Definisco la PSF
psf=zeros(21,21);
psf(1,1)=1/61;
psf(1,2)=1/61;
psf(21,21)=1/61;
psf(21,20)=1/61;
for i=2:20
for j=i-1:i+1
psf(i,j)=1/61;
end
end
B = A;
% Applico la sfocatura
for j = 1 : 3
B(:,:,j) = conv2(A(:,:,j), psf, 'same');
end
end