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), outline_length_(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),
94 int cn_type,
int geo_type,
135 return bounding_box_;
141 return num_features_;
147 return num_micro_features_;
150 return micro_features_;
153 return outline_length_;
156 return cn_feature_[index];
159 return geo_feature_[index];
174 return sample_index_;
177 sample_index_ = value;
180 return features_are_mapped_;
184 return mapped_features_;
188 return mapped_features_;
211 int num_micro_features_;
221 float cn_feature_[kNumCNParams];
236 bool features_are_indexed_;
237 bool features_are_mapped_;
242 static const int kYShiftValues[kSampleYShiftSize];
243 static const double kScaleValues[kSampleScaleSize];
250 #endif // TESSERACT_TRAINING_TRAININGSAMPLE_H__
void set_bounding_box(const TBOX &box)
bool DeSerialize(bool swap, FILE *fp)
TrainingSample * Copy() const
bool Serialize(FILE *fp) const
const TBOX & bounding_box() const
float MicroFeature[MFCount]
void set_sample_index(int value)
void MapFeatures(const IntFeatureMap &feature_map)
static TrainingSample * CopyFromFeatures(const INT_FX_RESULT_STRUCT &fx_info, const TBOX &bounding_box, const INT_FEATURE_STRUCT *features, int num_features)
void set_page_num(int page)
int geo_feature(int index) const
void set_class_id(int id)
const GenericVector< int > & mapped_features() const
const INT_FEATURE_STRUCT * features() const
bool features_are_mapped() const
UNICHAR_ID class_id() const
static TrainingSample * DeSerializeCreate(bool swap, FILE *fp)
FEATURE_STRUCT * GetCNFeature() const
float cn_feature(int index) const
const GenericVector< int > & indexed_features() const
const MicroFeature * micro_features() const
int outline_length() const
void set_is_error(bool value)
void set_weight(double value)
void IndexFeatures(const IntFeatureSpace &feature_space)
void DisplayFeatures(ScrollView::Color color, ScrollView *window) const
Pix * GetSamplePix(int padding, Pix *page_pix) const
Pix * RenderToPix(const UNICHARSET *unicharset) const
void ExtractCharDesc(int feature_type, int micro_type, int cn_type, int geo_type, CHAR_DESC_STRUCT *char_desc)
TrainingSample * RandomizedCopy(int index) const
void set_max_dist(double value)
int num_micro_features() const