%===========================================================
%
%        FILE: debluring_results.m
%  Written by: Joao Oliveira
% Last review: Sep 2009 
%         WWW: http://www.lx.it.pt/~jpaos/
%
%===========================================================
% Description: 
%
% This file generates the figures for experience 
% number 'exp' from simulated data, from paper: 
%
% João P. Oliveira, José M. Bioucas-Dias, Mário A.T. Figueiredo, 
% "Adaptive total variation image deblurring: A
% majorization?minimization approach",  Signal Processing,
% Volume 89, Issue 9, September 2009, Pages 1683-1693. 
%
%===========================================================




close all;
clear;

% Choose experiment to generate the figures
exp=1;
sufixo='_final02';

saveplots = 1;

setup_experiments;

dados_imagem=strcat(dados,'_exp_',num2str(exp),sufixo,'.mat');
load(dados_imagem);

load random_state;
randn('state',state);
img_noisy=conv2c(img,h)+sigma*randn(size(img));
    
fontsize=16;
symbolsize=12;
linewidth=2;

prefixo=strcat('data/exp_',num2str(exp));

figure(1);imagesc(img);colormap gray;axis off;

figure(2);imagesc(img_noisy);colormap gray;axis off;

figure(3);imagesc(img_tv2);colormap gray;axis off;

figure(4);plot([1:length(energyo)],energyo,'LineWidth',linewidth);colormap gray;
set(gca,'FontSize',fontsize);
ylabel('E[x^(^t^)]','FontSize',fontsize);
xlabel('MM iterations','FontSize',fontsize);


if saveplots
    filename=strcat(prefixo,'_imagem_original');
    print(1, '-depsc2', filename);

    filename=strcat(prefixo,'_imagem_noisy');
    print(2', '-depsc2', filename);

    filename=strcat(prefixo,'_imagem_restaurada');
    print(3', '-depsc2', filename);

    filename=strcat(prefixo,'_energia');
    print(4', '-depsc2', filename);
end
