filename = {'flowers.tiff', ...
            'flowers-tampered.tiff', ...
            'garden.jpg', ...
            'garden-tampered.jpg'};
Nb = [2, 8];
Ns = 1;
bayer = [0, 1;
         1, 0];
     
for i = 1:2:3     
     im_true = imread(filename{i});     
     im = imread(filename{i+1});
     for j = 1:2
        [map, stat] = locate_CFA(im, bayer, Nb(j),Ns);
        [h w] = size(map);
        stat(isnan(stat)) = 1;
        data = log(stat(:)); 
        data = data(not(isinf(data)|isnan(data)));
        n_bins = round(sqrt(length(data)));
        figure
        subplot(2,2,1), imshow(im_true), title('Not tampered image');
        subplot(2,2,2), imshow(im), title('Manipulated image');
        subplot(2,2,3), imagesc(map), colormap('gray'),axis equal, axis([1 w 1 h]), title(['Probability map (Nb = ',num2str(Nb(j)),')']);
        subplot(2,2,4), hist(data, n_bins), title('Histogram of the proposed feature');
        display('Press any key to continue...')
        pause
     end
end