documentation.h

00001 /*
00002 
00003     This file is part of the FAST-ER machine learning system.
00004     Copyright (C) 2008  Edward Rosten and Los Alamos National Laboratory
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License along
00017     with this program; if not, write to the Free Software Foundation, Inc.,
00018     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00019 */
00020 /**
00021 
00022 @mainpage
00023 
00024 \section gCopy Copyright and License
00025 
00026 The software is Copyright (c)  Edward Rosten and Los Alamos National
00027 Laboratory, 2008. There are no restrictions on using this software and it may
00028 only be redistributed under the terms of the GNU General Public License (a copy
00029 of which is included in the file LICENSE). No copyright is claimed on the
00030 output generated by these programs.  The files in the fast_trees directory are
00031 generated trivially from the programs included herein, and so are not under
00032 copyright.
00033 
00034 
00035 \section Introduction
00036 
00037 This project contains a suite of programs to generate an optimized corner
00038 detector, test corner detectors on a variety of datasets, generate MATLAB and
00039 optimized C++ code, and some utilities for handling the datasets. The project
00040 also includes ready to use pre-generated trees in the \p fast_trees directory.
00041 Generated trees in intermediate, C++ and MATLAB form are availavle for FAST-8,
00042 FAST-9, FAST-10, FAST-11, FAST-12 and FAST-ER. In the case of FAST-ER, the FAST
00043 detector has been learned from the best FAST-ER tree (included as \p
00044 best_faster.tree) with features extracted from all available images in the \link
00045 gDataset Cambridge dataset\endlink.
00046 
00047 To make on any unix-like environment, do:
00048 
00049 <code>./configure && make</code>
00050 
00051 There is no install option.
00052 
00053 This will create the following executables:
00054  - <code>\link learn_detector.cc learn_detector\endlink</code> This learns a detector from a repeatability dataset.
00055  - \link extract_features.cc \p extract_features \endlink This extracts features from an image sequence which can be turned in to a decision tree.
00056  - \link learn_fast_tree.cc \p learn_fast_tree \endlink This learns a FAST decision tree, from extracted data.
00057  - Programs for generating code from the learned tree, in various language/library combinations.
00058    - C++ / libCVD
00059        - \p fast_tree_to_cxx_score_bsearch
00060        - \p fast_tree_to_cxx_score_iterate
00061    - MATLAB
00062        - \p fast_tree_to_matlab_score_bsearch
00063  - <code>\link test_repeatability.cc test_repeatability\endlink</code> Measure the repeatability of a detector.
00064  - <code>\link warp_to_png.cc warp_to_png\endlink</code> This converts a repeatability dataset in to a rather faster loading format.
00065  - <code>\link image_warp.cc image_warp\endlink</code> This program allows visual inspection of the quality of a dataset.
00066  - <code>\link fast_N_features.cc fast_N_features\endlink</code> This program generates all possible FAST-N features for consumption by  \link learn_fast_tree.cc \p learn_fast_tree \endlink.
00067 
00068 \section sRequirements Requirements
00069 
00070 This code requires the following libraries from http://mi.eng.cam.ac.uk/~er258/cvd
00071 - libCVD (compiled with TooN and LAPACK support)
00072 - TooN
00073 - GVars3
00074 - tag
00075 For repeatability testing, the SUSAN detector can be used if the reference implementation
00076 is downloaded and placed in the directory. It is abailable from http://users.fmrib.ox.ac.uk/~steve/susan/susan2l.c
00077 
00078 \section learn_detector Running the system
00079 
00080 The complete sequence of operations for FAST-ER is as follows:
00081 <ol>
00082     <li> Make the executable:
00083 
00084         <code> ./configure && make </code>
00085 
00086     <li> Generating a new FAST-ER detector.
00087 
00088         An example detector (the best known detector, used in the results
00089         section of the paper) is already in \p best_faster.tree .
00090 
00091     <ol>
00092 
00093         <li> Set up <code>learn_detector.cfg</code>. The default parameters 
00094              are good, except you will need to set up the system to point to the
00095              \link gRepeatability repeatability dataset\endlink you wish to use.
00096 
00097         <li> Run the corner detector learning program
00098 
00099             <code>./learn_detector > logfile</code>
00100 
00101             If you run it more than once, you will probably want to alter the
00102             random seed in the configuration file.
00103             
00104 
00105         <li> Extract a detector from the logfile
00106 
00107             <code>awk 'a&&!NF{exit}a;/Final tree/{a=1}' logfile &gt; new_detector.tree</code>
00108 
00109     </ol>
00110 
00111     <li> Measuring the repeatability of a detector
00112         
00113         <code>./test_repeatability --detector faster2 --faster2 new_detector.tree > new_detector_repeatability.txt</code>
00114 
00115         The file <code>new_detector_repeatability.txt</code> can be plotted with almost any graph
00116         plotting program. A variety of detectors can be tested using this
00117         program. See \link test_repeatability.cc test_repeatability\endlink for
00118         more information.
00119 
00120     <li> Generating accelerated tree based detectors.
00121     
00122     <ol>
00123         <li> Features can be generated (for instance for FAST-N) or extracted
00124              from images, as is necessary for FAST-ER. FAST-N features can be
00125              extracted using \link fast_N_features.cc fast_N_features\endlink:
00126 
00127              <code>
00128                 ./fast_N_features --N 9 &gt; features.txt
00129              </code>
00130 
00131              Alternatively, they can be extracted from images using
00132              \link extract_features.cc extract_features\endlink:
00133 
00134              <code>
00135                 ./extract_features IMAGE1 [IMAGE2 ...] &gt; features.txt
00136              </code>
00137 
00138             
00139 
00140         <li> A decision tree can be learned from the features using
00141              \link learn_fast_tree.cc learn_fast_tree\endlink:
00142 
00143              <code>
00144              learn_fast_tree < features.txt > fast-tree.txt
00145              </code>
00146 
00147         <li> The decision tree needs to be turned in to source code before it
00148              can be easily used. This is performed using \p fast_tree_to_cxx_score_bsearch ,
00149              \p fast_tree_to_cxx_score_iterate , or \p fast_tree_to_matlab_score_bsearch .
00150             
00151              The name describes the target language, and the method by which the
00152              score is computed (iteraton or binary search). For monotonic trees, the
00153              result is the same, but for the more general non-monotonic trees produced
00154              by FAST-ER, the results may be slightly different.
00155 
00156              These programs are used in the following way:
00157 
00158              <code>
00159              fast_tree_to_cxx_score_bsearch NAME fast-tree.txt > fast_tree.cxx
00160              </code>
00161 
00162              NAME specifies the name of the function. If Matlab code is generated, 
00163              then it is recommended that NAME is used for an output file NAME.m.
00164 
00165              The result is a usable source code file. In the case of generated C++, 
00166              the file is compatible with libCVD, and the output of the corner detector
00167              can be fed to libCVD's nonmax_suppression function.  The generated code
00168              does not make use of SSE. To do this, you will have to specify weights
00169              to \link learn_fast_tree.cc learn_fast_tree\endlink and modify
00170              \p fast_tree_to_cxx_score_bsearch to hardwire the initial questions in 
00171              the tree.
00172 
00173              In the case of Matlab, the generated file comes with code to perform 
00174              nonmaximal suppression if desired. This code is generated in straight
00175              Matlab, so corner detection will not be especially fast.
00176     </ol>
00177 </ol>
00178 
00179 */
00180 
00181 /**
00182 @defgroup gRepeatability Measuring the repeatability of a detector
00183 
00184 Functions to load a repeatability dataset, and compute the repeatability of
00185 a list of detected points.
00186 
00187 
00188 \section data The dataset
00189 
00190 The dataset consists of a number of registered images. The images are stored in
00191 <code>frames/frame_X.pgm</code> where X is an integer counting from zero.  The
00192 frames must all be the same size. The warps are stored in
00193 <code>waprs/warp_Y_Z.warp</code>. The file <code>warp_Y_Z.warp</code> contains
00194 one line for every pixel in image Y (pixels arranged in raster-scan order). The
00195 line is the position that the pixel warps to in image Z. If location of -1, -1
00196 indicates that this pixel does not appear in image Z.
00197 
00198 */
00199 
00200 /**       
00201 @defgroup  gDataset Repeatability dataset
00202 
00203 To compute repeatability, you must know for every pixel in image <i>A</i>, where
00204 that pixel ends up in image <i>B</i>. The datasets are stored internally as:
00205 - Images are simply stored internally as: <code> vector<Image<byte> > </code>
00206 - Mappings from <i>A</i> to <i>B</i> are stored as: <code> vector<vector<array<float, 2> > > </code>
00207   so <code>mapping[i][j][y][x]</code>, is where pixel \f$(x, y)\f$ in image <i>i</i>  should appear in image <i>j</i>
00208 
00209 
00210 These datasets can be stored in disk in several formats. However, they are
00211 loaded by a single function, ::load_data(string, int, string) In all datasets, all images must
00212 be the same size.
00213 
00214 \section camDataset Cambridge dataset format.
00215 
00216 The consists of <i>N</i> images, and an arbitrary warp for each image pair. From
00217 some base directory, the files are stored as:
00218     - frames/frame_<i>x</i>.pgm
00219     - warps/warp_<i>i</i>_<i>j</i>.warp
00220 The warp files have the mapping positions stored in row-major format, one pixel
00221 per line, stored as a pair of real numbers in text format. Details are in
00222 ::load_warps_cambridge() and ::load_images_cambridge(). The indices, <i>x</i>,
00223 <i>i</i> and <i>j</i> count from zero.
00224 
00225 \subsection canPNG Cambridge PNG dataset.
00226 
00227 This stores the warp data in 16 bit per channel (with a numeric range of
00228 0--65535), colour PNG format:
00229     - frames/frame_<i>x</i>.pgm
00230     - pngwarps/warp_<i>i</i>_<i>j</i>.png
00231 The destination of the <i>x</i> coordinare is stored as \f$x =
00232 \frac{\text{red}}{\text{MULTIPLIER}} - \text{SHIFT}\f$, and the <i>y</i> destination as \f$y =
00233 \frac{\text{green}}{\text{MULTIPLIER}} - \text{SHIFT}\f$. ::MULTIPLIER is 64.0 and ::SHIFT is 10.0 The
00234 blue channel stores nothing. Details are in ::load_warps_cambridge_png().
00235 
00236 The executable warp_to_png.cc converts a <code>.warp</code> file to a
00237 <code>.png</code> file.
00238 
00239 \section oxDataset Oxford VGG dataset format.
00240 
00241 The datasets consist on <i>N</i> images and <i>N-1</i> Homographies describing
00242 the warps between images the first and <i>N</i><sup>th</sup> image. The first
00243 homography is therefore the identity matrix.
00244 
00245 From a base directory, the files are:
00246 - H1to<i>i</i>p
00247 - img<i>i</i>.ppm
00248 
00249 where the index <i>i</i> counts from 1. More details are in ::load_warps_cambridge_png() and ::load_images_vgg().
00250 
00251 */
00252 
00253 /**
00254 @defgroup  gTree Tree representation.
00255 
00256 */
00257 
00258 /**
00259 @defgroup  gFastTree Compiled tree representations
00260 
00261 */
00262 
00263 /**
00264 @defgroup  gUtility Utility functions.
00265 
00266 */
00267 
00268 /** 
00269 @defgroup gDetect Functions for detecting corners of various types.
00270 */
00271 
00272 /**
00273 @defgroup  gOptimize Optimization routines
00274 
00275 The functions in this section deal specifically with optimizing a decision tree
00276 detector for repeatability. The code in ::learn_detector() is a direct
00277 implementation of the algorithm described in section V of the accompanying
00278 paper.
00279 
00280 The manipulation of the tree is necessarily tied to the internal representation
00281 which is described in \link gTree the tree representation\endlink.
00282 
00283 */

Generated on Mon Mar 2 12:47:12 2009 for FAST-ER by  doxygen 1.5.3