]> AND Private Git Repository - these_gilles.git/blob - THESE/codes/nlmeans/demo.m
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
lecture ch 1 à 3 27nov
[these_gilles.git] / THESE / codes / nlmeans / demo.m
1 clear\r
2 clc\r
3 clf\r
4 colormap(gray)\r
5 \r
6 % create example image\r
7 ima=100*ones(100);\r
8 ima(50:100,:)=50;\r
9 ima(:,50:100)=2*ima(:,50:100);\r
10 fs=fspecial('average');\r
11 ima=imfilter(ima,fs,'symmetric');\r
12 \r
13 % add some noise\r
14 sigma=10;\r
15 rima=ima+sigma*randn(size(ima));\r
16 \r
17 % show it\r
18 imagesc(rima)\r
19 drawnow\r
20 \r
21 % denoise it\r
22 fima=NLmeansfilter(ima,5,2,sigma);\r
23 \r
24 % show results\r
25 clf\r
26 subplot(2,2,1),imagesc(ima),title('original');\r
27 subplot(2,2,2),imagesc(rima),title('noisy');\r
28 subplot(2,2,3),imagesc(fima),title('filtered');\r
29 subplot(2,2,4),imagesc(rima-fima),title('residuals');\r
30 \r