Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

train-texton.C File Reference


Detailed Description

create the prototypical universal textons "database" from the training data

Definition in file train-texton.C.

#include "Neuro/GistEstimatorTexton.H"
#include "Neuro/StdBrain.H"
#include "Neuro/NeuroOpts.H"
#include "Neuro/NeuroSimEvents.H"
#include "Media/SimFrameSeries.H"
#include "Media/MediaOpts.H"
#include "Simulation/SimEventQueue.H"
#include "Simulation/SimEventQueueConfigurator.H"
#include "Channels/ChannelOpts.H"
#include "Component/ModelManager.H"
#include "Component/ModelOptionDef.H"
#include "Image/Point2D.H"
#include "nub/ref.h"
#include <fstream>
#include <sstream>
#include <ios>
#include <numeric>
#include <algorithm>
#include <functional>
#include <map>
#include <vector>
#include <iterator>
#include <stdexcept>
#include <utility>
#include <limits>
#include <cmath>

Include dependency graph for train-texton.C:

Go to the source code of this file.

Defines

#define CV_32FC1   0
#define CV_32SC1   0
#define CV_MAT_ELEM(matrix, type, row, col)   (type(0))
#define CV_TERMCRIT_EPS   0
#define CV_TERMCRIT_ITER   0
#define TT_KMEANS_ITERATIONS   (100)
#define TT_KMEANS_PRECISION   (.01)
#define TT_NUM_UNIVERSAL_TEXTONS   100
#define TT_DEFAULT_TRAINING_TEXTONS_FILE   "training_textons.txt"
#define TT_DEFAULT_UNIVERSAL_TEXTONS_FILE   "universal_textons.txt"
#define TT_DEFAULT_TRAINING_HISTOGRAM_NAME   "training_image"
#define TT_DEFAULT_TRAINING_HISTOGRAMS_FILE   "training_histograms.txt"
#define TT_DEFAULT_CLASSIFICATION_RESULTS_FILE   "texton_classifications.txt"
#define TT_ACCUMULATE_CMD   "accumulate"
#define TT_KMEANS_CMD   "kmeans"
#define TT_HISTOGRAM_CMD   "histogram"
#define TT_CLASSIFY_CMD   "classify"
#define TT_ACTIONS

Typedefs

typedef GistEstimatorTexton::ImageType Texton
typedef Image< double > Histogram
typedef std::map< std::string,
Histogram
HistogramMap
typedef HistogramMap::value_type HistogramMapEntry
typedef std::pair< std::string,
double > 
HistogramDistance

Functions

CvMat * cvCreateMat (int, int, int)
void cvZero (CvMat *)
void cvReleaseMat (CvMat **)
double cvmGet (CvMat *, int, int)
void cvmSet (CvMat *, int, int, double)
int cvTermCriteria (int, int, double)
void cvKMeans2 (CvMat *, int, CvMat *, int)
int CV_MAT_TYPE (int)
template<typename T>
std::string to_string (const T &t)
int count_lines (const std::string &file_name)
bool is_zero (double d)
void accumulate_textons (const Texton &textons)
CvMat * load_training_textons (const std::string &file_name, int num_lines)
CvMat * compute_centroids (int K, const OpenCVMatrix &data, const OpenCVMatrix &cluster_assignments)
CvMat * kmeans (int K, const OpenCVMatrix &data)
void save_universal_textons (const OpenCVMatrix &universal_textons, const std::string &file_name)
Texton load_universal_textons (const std::string &file_name)
void save_histogram (const Histogram &histogram, const std::string &hist_name, const std::string &file_name)
HistogramMap load_training_histograms (const std::string &file_name)
bool chi_square_cmp (const HistogramDistance &L, const HistogramDistance &R)
std::ostream & operator<< (std::ostream &os, const HistogramDistance &D)
void classify_image (const HistogramMapEntry &input, const HistogramMap &training_histograms, const std::string &results_file)
int main ()

Variables

const ModelOptionCateg MOC_TEXTONS
const ModelOptionDef OPT_TrainingTextons
const ModelOptionDef OPT_UniversalTextons
const ModelOptionDef OPT_HistogramName
const ModelOptionDef OPT_HistogramFile
const ModelOptionDef OPT_ResultsFile


Define Documentation

#define TT_ACTIONS
 

Value:

Definition at line 743 of file train-texton.C.


Variable Documentation

const ModelOptionCateg MOC_TEXTONS [static]
 

Initial value:

 {
   MOC_SORTPRI_3,
   "Options specific to the Renninger-Malik textons program",
}

Definition at line 605 of file train-texton.C.

const ModelOptionDef OPT_HistogramFile [static]
 

Initial value:

 {
   MODOPT_ARG_STRING, "HistogramFile", & MOC_TEXTONS, OPTEXP_CORE,
   "This option specifies the name of the training histograms database,\n"
   "a plain text file containing one histogram entry per line. The\n"
   "first field specifies the name plus number of the entry (e.g.,\n"
   "foo_1, foo_2, bar_1, and so on). The remaining fields are simply the\n"
   "hundred numbers making up the image's universal textons histogram.\n",
   "histogram-file", '\0', "training-histograms-file",
   TT_DEFAULT_TRAINING_HISTOGRAMS_FILE,
}

Definition at line 672 of file train-texton.C.

const ModelOptionDef OPT_HistogramName [static]
 

Initial value:

 {
   MODOPT_ARG_STRING, "HistogramName", & MOC_TEXTONS, OPTEXP_CORE,
   "This option specifies the \"root\" name of the histogram entry in\n"
   "the training histograms database. The histogram number will be\n"
   "appended to this \"root\" name. The training histograms database\n"
   "is a plain text file containing one histogram entry per line. The\n"
   "first field specifies the name plus number of the entry (e.g.,\n"
   "foo_1, foo_2, bar_1, and so on). The remaining fields are simply the\n"
   "hundred numbers making up the image's universal textons histogram.\n\n"
   "In classification mode, this option specifies the name of the input\n"
   "image's histogram that is written to the results file.\n",
   "histogram-name", '\0', "histogram-name-root",
   TT_DEFAULT_TRAINING_HISTOGRAM_NAME,
}

Definition at line 653 of file train-texton.C.

const ModelOptionDef OPT_ResultsFile [static]
 

Initial value:

 {
   MODOPT_ARG_STRING, "ResultsFile", & MOC_TEXTONS, OPTEXP_CORE,
   "This option specifies the name of the classification results file,\n"
   "a plain text file containing one result entry per line. The first\n"
   "field specifies the name of the input image plus number of the entry,\n"
   "(e.g., foo_1, foo_2, bar_1, and so on). Then come the names of the\n"
   "top five matching images from the training set.\n",
   "results-file", '\0', "classification-results-file",
   TT_DEFAULT_CLASSIFICATION_RESULTS_FILE,
}

Definition at line 689 of file train-texton.C.

const ModelOptionDef OPT_TrainingTextons [static]
 

Initial value:

 {
   MODOPT_ARG_STRING, "TrainingTextons", & MOC_TEXTONS, OPTEXP_CORE,
   "This option specifies the name of the file where training textons\n"
   "should be accumulated or read from. This is a plain text file containing\n"
   "the training textons matrix that will be fed into the K-means procedure\n"
   "during the texton training phase. Each line of this file will contain a\n"
   "row of training textons.\n",
   "training-textons", '\0', "training-textons-file",
   TT_DEFAULT_TRAINING_TEXTONS_FILE,
}

Definition at line 616 of file train-texton.C.

const ModelOptionDef OPT_UniversalTextons [static]
 

Initial value:

 {
   MODOPT_ARG_STRING, "UniversalTextons", & MOC_TEXTONS, OPTEXP_CORE,
   "This option specifies the name of the file in which the universal\n"
   "textons are (or are to be) stored. This is a plain text file containing\n"
   "the universal_textons matrix that is used for image classification.\n",
   "universal-textons", '\0', "universal-textons-file",
   TT_DEFAULT_UNIVERSAL_TEXTONS_FILE,
}

Definition at line 633 of file train-texton.C.


Generated on Sun Nov 22 13:44:00 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4