changeset 44:2c59257d734c

(none)
author idamnjanovic
date Mon, 14 Mar 2011 15:42:42 +0000
parents 984c3c175be2
children b9465d2bb3b0
files Problems/generateImageDenoiseProblem.m
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Problems/generateImageDenoiseProblem.m	Mon Mar 14 15:41:59 2011 +0000
+++ b/Problems/generateImageDenoiseProblem.m	Mon Mar 14 15:42:42 2011 +0000
@@ -67,8 +67,9 @@
     [pathstr, name, ext, versn] = fileparts(filename);
     data.name=name;
     im = imread(filename);
-    im = double(im);
+    %im = double(im);
 end;
+im = double(im);
 cd(TMPpath);
 
 %% check input parameters %%
@@ -93,7 +94,7 @@
 
 x = imnoise;
 p = ndims(x);
-
+psnr=20*log10(maxval * sqrt(numel(im)) / norm(im(:)-imnoise(:)));
 if (p==2 && any(size(x)==1) && length(blocksize)==1)
     p = 1;
 end
@@ -134,11 +135,18 @@
     X(:,blockids) = remove_dc(X(:,blockids),'columns');
 end
 
+%  Noisy image blocks 
+xcol=im2col(x,blocksize,'sliding');
+[b1, dc] = remove_dc(xcol,'columns');
+
 %% output structure %%
 
 data.Original = im;
 data.Noisy = imnoise;
+data.noisy_psnr=psnr;
 data.b = X;
+data.b1=b1;
+data.b1dc=dc;
 data.m = size(X,1);
 data.n = size(X,2);
 data.p = dictsize;