Quick and dirty way to get started on SLAM without reading the manual
=====================================================================

* Prepare image sequences in PGM format with the following naming convention

	  <name>__<num>_<num>_ ... <num>.pgm

  Examples
  --------

  For a 1 DOF sequence of 5 images at 10 deg. offsets, the following names
  could be used:
  
      obj01__1.pgm
      obj01__2.pgm    
      obj01__3.pgm
      obj01__4.pgm
      obj01__5.pgm

  For a 2 DOF sequence of 9 images (obtained say with 3 10mm translations in
  the x and y directions):

      feature__1__1.pgm
      feature__1__2.pgm
      feature__1__3.pgm
      feature__2__1.pgm
      feature__2__2.pgm
      feature__2__3.pgm
      feature__3__1.pgm
      feature__3__2.pgm
      feature__3__3.pgm

  For additional details see the man page for NamingScope by typing
  "man NamingScope" (assuming man pages have been correctly installed).

* Convert the PGM image files to Image Vectors using "ximgtool" as follows.
	  1) Load the Image set using the File menu.
	  2) Segment and normalize if necessary using the Options menu.
	  3) Perform the actual conversion from Image to Vector using the
	     Save As item from the File menu and selecting Vector Set.
  After the above, you should have a Vector set with the filename extensions
  changed to "vec" from "pgm".

  Note that Vectors can be created directly from grabbed images by writing
  your own program and using the SLAM library (libeigen.a) and the ImageUtil
  class (see imageutil.h and image.h).

  Example program
  ---------------

  #include "image.h"
  #include "imageutil.h"
  #include "vector.h"

  main()
  {
	Image im;
	Vector vec;

	grabImage(&im); // Routine to use your digitizer to grab an Image

	ImageUtil::imageToVector(im, &vec); // Use ImageUtil to perform
					    // conversion from Image to Vector

	IOUtil::put(vec, "image__0.vec"); // Use IOUtil to save Vector to file
				          // image.vec. Make sure you use
					  // proper naming convention.
  }

  Compile and link as follows (roughly! make sure you supply the paths for the
  header files and libeigen.a):

	CC -o im2vec im2vec.C -leigen -lm

* Compute eigen vectors using xeigen or eigen.

  Examples
  --------
    
  For the above 1 DOF vector set, the first 2 eigen vectors along with the
  average vector can be computed as follows:
    	
	eigen -V -eobj01.evc -A -aobj01__avg.vec -n2 obj01

  For the 2 DOF vector set, the first 2 eigen vectors along with the average
  vector can be computed as follows:

	eigen -V -efeature.evc -A -afeature__avg.vec -n2 feature

  The eigenvectors are stored in the file specifed by -e and the average
  vector in the file specified by -a

* Project image vectors to eigenspace using project or xmanifold.

  Examples
  --------

  project -V -eobj01.evc -A -aobj01__avg.vec -n2 obj01

  project -V -efeature.evc -A -afeature__avg.vec -n2 feature

  The projected points are stored in files obj01.prj and feature.prj
  respectively.

* Interpolate projected points to obtain a parametric manifold (quadratic
  B-Spline) using fitbspl or xmanifold.

  Examples
  --------

  fitbspl -V obj01.prj

  fitbspl -V feature.prj

  The files generated will be obj01.spc and feature.sps respectively. The
  extension prj is replaced by spc, sps or spv depending whether the manifold
  has 1, 2 or 3 DOF (parameters).

* Resample manifold densely using xmanifold or sample.

  Examples
  --------

  sample -V -s100 obj01.spc

  Samples manifold at 99 equally spaced intervals in the manifold's parameter
  space to obtain 100 points. Resampled points are stored in file obj01.smp.

  sample -V -s50,20 feature.sps

  Samples manifold at 49 and 19 equally spaced intervals in the manifold's
  parameter spaces. Resampled points are stored in file feature.smp.

* Construct search objects 

  Examples
  --------

  mkbinarysrch -V -v0,99 obj01.smp

  Contructs a binary search object in obj01.tbl. The -v option is used to
  control the values returned by the binarysearch object. In this case, we
  force it to return values from 0 to 99, which is exactly the index of the
  closest point.

  mkbinarysrch -V -v0,999 feature.smp

  Contructs a binary search object in feature.tbl. The -v option is used to
  control the values returned by the binarysearch object. In this case, we
  force it to return values from 0 to 999, which is exactly the index of the
  closest point.

  mkexhaustivesrch -V -v0,999 feature.smp

  Contructs an exhaustive search object in feature.tbl. The -v option is used
  to control the values returned by the exhaustive search object. In this
  case, we force it to return values from 0 to 999, which is exactly the index
  of the closest point.

* Perform closest point search

  Example program
  ---------------

  #include "vector.h"
  #include "searchutil.h"
  #include "ioutil.h"
  #include <iostream.h>

  #define EPSILON .1

  main()
  {
	int	   i;
	Vector	   avg, img, param(1), closest;
	VectAry	   eigen;
	SearchUtil su;

	IOUtil::get(&avg, "feature__avg.vec");	// Load the average vector
	IOUtil::get(&va, "feature.evc");	// Load the eigenvectors

	su.setScheme("feature.tbl");		// Load the search object
	param.element(0, EPSILON);		// Epsilon for binarysearch
	su.setSearchParameters(param);		// Set epsilon in object

	img = GrabImage();			// Grab an image

	img -= avg;				// Subtract average

	Vector proj(eigen.getSize());		// Construct Projection Vector

	// Project to eigenspace
	for(i = 0; i < eigen.getSize(); ++i)
	      proj.element(i, img * eigen[i]);
	
	closest = su.search(proj);

	cout << "Closest point is [" << int(closest.element(0)) << ']' << endl;
	cout << su.getData(int(closest.element(0))) << endl << endl;

	return 0;
  }

  Compile and link the above program as follows:

	CC -o recognize recognize.C -I<wherever you have your include files>
-L<wherever you have libeigen.a> -leigen -lm
