16 #ifndef TESSERACT_TRAINING_TRAININGSAMPLE_H__
17 #define TESSERACT_TRAINING_TRAININGSAMPLE_H__
34 class IntFeatureSpace;
38 static const int kNumCNParams = 4;
40 static const int kSampleYShiftSize = 5;
42 static const int kSampleScaleSize = 3;
50 static const int kSampleRandomSize = kSampleYShiftSize * kSampleScaleSize - 2;
56 : class_id_(INVALID_UNICHAR_ID), font_id_(0), page_num_(0),
57 num_features_(0), num_micro_features_(0),
58 features_(
NULL), micro_features_(
NULL), weight_(1.0),
59 max_dist_(0.0), sample_index_(0),
60 features_are_indexed_(false), features_are_mapped_(false),
91 int cn_type,
int geo_type,
132 return bounding_box_;
138 return num_features_;
144 return num_micro_features_;
147 return micro_features_;
150 return cn_feature_[index];
153 return geo_feature_[index];
168 return sample_index_;
171 sample_index_ = value;
174 return features_are_mapped_;
178 return mapped_features_;
182 return mapped_features_;
205 int num_micro_features_;
211 float cn_feature_[kNumCNParams];
226 bool features_are_indexed_;
227 bool features_are_mapped_;
232 static const int kYShiftValues[kSampleYShiftSize];
233 static const double kScaleValues[kSampleScaleSize];
240 #endif // TESSERACT_TRAINING_TRAININGSAMPLE_H__
TrainingSample * Copy() const
float cn_feature(int index) const
int num_micro_features() const
bool Serialize(FILE *fp) const
void set_page_num(int page)
void MapFeatures(const IntFeatureMap &feature_map)
void ExtractCharDesc(int feature_type, int micro_type, int cn_type, int geo_type, CHAR_DESC_STRUCT *char_desc)
bool features_are_mapped() const
const TBOX & bounding_box() const
const GenericVector< int > & mapped_features() const
bool DeSerialize(bool swap, FILE *fp)
UNICHAR_ID class_id() const
void set_is_error(bool value)
void set_bounding_box(const TBOX &box)
void IndexFeatures(const IntFeatureSpace &feature_space)
static TrainingSample * CopyFromFeatures(const INT_FX_RESULT_STRUCT &fx_info, const INT_FEATURE_STRUCT *features, int num_features)
void DisplayFeatures(ScrollView::Color color, ScrollView *window) const
TrainingSample * RandomizedCopy(int index) const
float MicroFeature[MFCount]
static TrainingSample * DeSerializeCreate(bool swap, FILE *fp)
const MicroFeature * micro_features() const
void set_sample_index(int value)
void set_class_id(int id)
void set_max_dist(double value)
void set_weight(double value)
const INT_FEATURE_STRUCT * features() const
int geo_feature(int index) const
const GenericVector< int > & indexed_features() const
Pix * RenderToPix(const UNICHARSET *unicharset) const
Pix * GetSamplePix(int padding, Pix *page_pix) const