4
: ³
:
. . 5
.
:
..
- 2016
: .
MATLAB:
1. imnoise - .
, , .
2. imnoise2 - .
imnoise, imnoise2 R MxN, . imnoise , imnoise , a imnoise2 . . , , : 0 - , 1 - , 0.5 .
3. imnoise3 - .
4. roipoly - (ROI).
S . S , . , . , Backspace Delete. . Enter.
5. histroi - ROI.
6. statmoments - .
7. checkerboard - .
8. fspecial - ().
h , type. h filter2 conv2, . 1, 2.
9. imfilter - .
Գ A H. A - . B , A.
B . A , , , .
10. deconvwnr - .
³ I, PSF . . , ³ .
|
|
ճ :
, .
:
1) , .
a) .
b) .
2) .
a) .
b) .
c) .
d) .
e) .
f) .
3) ³ ( ).
a) .
b) .
c) .
d) .
:
, imread imshow.
(ROI) roipoly. ( , .) .
, histroi.
imnoise .
.
:
statmoments .
imnoise2 .
³ :
³ .
.
:
clc %
clear %
f=imread(' D:\\\Cyfrova obrobka \vazon.tif');%
figure (1)
imshow(f); %
title (' ');
xlabel(Romanchyk., 5');
%
B=imread(' maskbinary.tif');
figure (2)
imshow(B);
title (' ');
%
% - , - . , r - .
% step
[K, c, r]=roipoly(B);
figure (3)
imshow(K);
title (' K');
xlabel(Romanchyk., 5');
% ó ROI t K
p=imhist(f(K));
%figure (4)
%imshow(K);
% - , npix - ROI
[p,npix]=histroi(f,c,r);
|
|
npix
figure (4)
bar(p, 1);
title ('ó ROI t K');
xlabel(Romanchyk., 5');
% v(1)- , v(2) -
[v, unv]=statmoments(p,2);
var=sqrt(v(2))*256;
ms=v(1)*256;
%
X=imnoise2('gaussian', npix, 1, ms, var);
figure (5)
hist(X, 130);
axis([0 300 0 140])
title ([' , .=', num2str(ms, 3), ' =', num2str(var, 3)]);
xlabel(Romanchyk., 5');
:
.1.
.2.
.3. K
.4.ó ROI
.5.
-, :
clc %
clear %
%
f=imread('Tracy.tif');%
figure (1)
imshow(f); %
title (' ');
xlabel(Romanchyk., 5');
t=imnoise(f, 'gaussian',0, 0.01);
figure (2)
imshow(t);
title (' ');
xlabel(Romanchyk., 5');
%
imwrite(t, 'Shum_Tracy.tif')
%
B=roipoly(t);
figure (3)
imshow(B);
title (' ');
xlabel(Romanchyk., 5');
%
% - , - . , r - .
% step
[K, c, r]=roipoly(B);
figure (3)
imshow(K);
title (' K');
xlabel(Romanchyk., 5');
% ó ROI t K
p=imhist(t(K));
%figure (4)
%imshow(K);
% - , npix - ROI
[p,npix]=histroi(f,c,r);
npix
figure (4)
bar(p, 1);
title ('ó ROI t K');
% v(1)- , v(2) -
[v, unv]=statmoments(p,2);
var=sqrt(v(2))*256;
ms=v(1)*256;
%
X=imnoise2('gaussian', npix, 1, ms, var);
figure (5)
hist(X, 130);
axis([0 300 0 140])
title ([' , .=', num2str(ms, 3), ' =', num2str(var, 3)]);
:
.6.
.7.
.8.
.9.
.10.
- :
clc %
clear %
% ³
g=imread('Shum_Tracy.tif');%
figure (1)
imshow(g); %
title (' ');
xlabel(Romanchyk., 5');
%
w=fspecial('average', [3,3]); % 3*3
gr=imfilter(g, w, 'replicate'); % replicate
figure (2)
imshow(gr, []);
title ('³ , ');
%
f=im2double(g);
f1=padarray(f, [5,5], 'replicate');
f=colfilt(f1, [3,3], 'sliding', @gmean);
f1=im2uint8(f);
figure (3)
imshow(f1);
title ('³ , ');
%
f=imread('Tracy.tif');%
figure (4)
imshow(f);
fn=imnoise(f, 'salt & pepper');
figure (5)
imshow(fn);
title (' , ');
Q=medfilt2(fn, [3,3], 'symmetric');
figure (6)
imshow(Q);
title ('³ , ');
% Գ
f2=ordfilt2(g, 1, ones(3*3));
figure (7)
imshow(f2);
title ('³ , Գ ');
% Գ
f3=ordfilt2(g, 3*3, ones(3*3));
figure (8)
imshow(f3);
title ('³ , Գ ');
:
.11.
.12.
.13.
|
|
.14. ,
.15.
.16.Գ
.17.Գ
: , . , .
³
a) .
b) .
c) ³ .
-, :
%
clc
clear
%f=checkerboard(8);
f1= imread('Tracy.tif');
f=im2double(f1);
PSF= fspecial ('motion', 70, 45);
figure (1);
imshow(f);
title (' ,')
% ,
% :
g=imfilter(f, PSF, 'circular');
figure(2);
imshow(g);
noise=imnoise(zeros(size(f)), 'gaussian', 0,0.1);
gb=g+noise;
figure(3);
imshow(gb,[]);
title (' ');
% fr1 -
fr1=deconvwnr(gb,PSF);
% R
Sn=abs(fft2(noise)).^2; % noise power spectrum
nA=sum(Sn(:))/prod(size(noise)); % noise avarage power
Sf=abs(fft2(f)).^2; % image power spectrum
fA=sum(Sf(:))/prod(size(noise)); % image avarage power
R=nA/fA;
% ³ R
fr2=deconvwnr(gb,PSF,R);
%
figure(4), imshow(fr1, [])%
title (' ');
figure(5), imshow(fr2, [])%
title (' ');
%
NCORR=fftshift(real(ifft2(Sn)));
ICORR=fftshift(real(ifft2(Sf)));
fr3=deconvwnr(gb,PSF,NCORR,ICORR);
%
figure(6), imshow(fr3, [])%
title (' ');
:
.18.
.19.
.20.
.21.
.22.
.23.
: , . .