% load the data:
load cells;

sig = 3;

% type of LBP map
maph= getlbpmap(8,'u2'); 

% compute feature for train and test:
N = size(x,1);
for i=1:N
   i
   % get image data from green channel:
  % im = sum(x{i,1}(:,:,2),3);
  % if (min(im(:))<0)
  %    error('pixel values < 0');
 %  end
   %im = double(hist_equalize(im));
   
   im = x{i,1}(:,:,2);
   im = im_gauss(double(im),sig,sig);
   im = im.*double(x{i,2});
   x{i,1} = lbp(im,1,8,maph,'nh');
       
   
end
M = size(z,1);
for i=1:M
   i
  % im = sum(z{i,1}(:,:,2),3);
  % if (min(im(:))<0)
  %    error('pixel values < 0');
  % end
   %im = double(hist_equalize(im));
   

   im = z{i,1}(:,:,2);
   im = im_gauss(double(im),sig,sig);
   im = im.*double(z{i,2});
   z{i,1} = lbp(im,1,8,maph,'nh');
end

save cells_lbp_gauss3 x z;
