%"Copyright 1994 by Facia Reco Associates.  All rights reserved.
%"Copyright 1994 by the Massachusetts Institute of Technology.  


There are 4 MATLAB files in this directory:

klt.m		performs the discrete KL transform on a set of vectors

project.m	does the projection on the resulting eigenspace,
	       	computes the "distance-from-feature-space" and
		the reconstruction.

dffs_map.m	computes the "distance-from-feature-space" at every pixel
		over in input image

read_uchars.m	utility for reading in a set of images into a matrix



These files have MATLAB help files built in, so you can type (for example) 

>> help klt

inside MATLAB for help on their syntax and function.


----------------------------------------------------------------------

Step 1:

Take your set of training images and put them in a directory.  The
files should be unsigned char (8 bits/pixel) in standard raster format
(with NO headers, just raw pixel dumps). Most importantly, they should
be labeled data0, data1, data2 .... dataN


Step 2:

From inside matlab use read_uchars() to read them into a matrix, where
each column is the vectorized image (column-concatenated). The
arguments to read_uchars are the directory dir, an index vector n that
indicates which (possibly a subset) of the data you wanna read in, and
a 1-by-2 vector Size of the dimensions of the image. Type help
read_uchars in Matlab for more info.

Eg. Lets say you have 50 images of size 640-by-480 in the directory Test
to read all the even ones into a matrix in Matlab you issue the command.

>> X = read_uchars('Test',0:2:48,[640 480]);


Step 3:

Next you compute the principal components using the following command
(type "help klt" in matlab for more detailed info):

>> [U,Xm] = klt(X);


Step 4:

To project this (or another matrix of images) onto, say the first 10
eigenvectors, use project()

>> C = project(X,Xm,U,1:10);

C is now a matrix of coefficients, where each column is the expansion
coefficients of the corresponding image in X


Step 5:

To compute the "distance-from-feature-space" metric for a set of
images X, use project.m with the second output argument:

>> [C,D] = project(X,Xm,U,1:10);

To compute the DFFS metric at every pixel in an input image, use the
function dffs_map.m












