%              rof_mex_demo.m  by Tom Goldstein
% This code tests the method defined by "SplitBregmanROF.c".  


% Step 1: Compile the "SplitBregmanROF.c"
mex SplitBregmanROF.c;

% Step 2:  Get the test image
exact = double(imread('cameraman.tif'));
dims = size(exact);

noisy = exact+15*randn(dims);

% Step 3: Denoise the Image

clean = SplitBregmanROF(noisy,.05,0.001);

% Step 4:  Display Results

close all;
figure;
%
subplot(2,2,1);
imagesc(exact);
colormap(gray);
title('Original');

subplot(2,2,2);
imagesc(noisy);
colormap(gray);
title('noisy');

subplot(2,2,3);
imagesc(clean);
colormap(gray);
title('denoised');

subplot(2,2,4);
imagesc(noisy-clean);
colormap(gray);
title('difference');
