% SHOW_DENOISING Image denosing of USPS hand-written numerals.
%
% Description:
% The input noisy images are denoised using the
% kernel PCA model. The denosing based on linear PCA
% is also computed for comparision. Imgase of
% - Ground truth numerlas
% - Noisy numerals
% - Numerals denoised by kernel PCA
% - Numerals denoised by linear PCA
% are displayed.
%
% See also
% KPCAREC, PCAREC.
%
% About: Statistical Pattern Recognition Toolbox
% (C) 1999-2003, Written by Vojtech Franc and Vaclav Hlavac
% <a href="http://www.cvut.cz">Czech Technical University Prague</a>
% <a href="http://www.feld.cvut.cz">Faculty of Electrical Engineering</a>
% <a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a>
% Modification:
% 07-jun-2004, VF
% 05-may-2004, VF
% 22-apr-2004, VF
help show_denoising;
kpca_filename = 'USPSModelGreedyKPCA.mat';
lpca_filename = 'USPSModelLinPCA.mat';
input_data_file = '/home/xfrancv/data/usps/usps_noisy';
load(kpca_filename,'kpca_model');
load(lpca_filename,'lpca_model');
load(input_data_file,'tst');
inx = [];
for i=1:10,
tmp = find(tst.y == i);
inx = [inx, tmp(1) ];
end
noisy_X = tst.X(:,inx);
gnd_X = tst.gnd_X(:,inx);
kpca_X = kpcarec( noisy_X, kpca_model);
lpca_X = pcarec( noisy_X, lpca_model);
h=figure; set(h,'name','Denoised by greedy KPCA');
showim( kpca_X);
h=figure; set(h,'name','Denoised by linear PCA');
showim( lpca_X);
h=figure; set(h,'name','Ground truth');
showim( gnd_X);
h=figure; set(h,'name','Noisy');
showim( noisy_X);