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_(nullptr), micro_features_(nullptr), 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_;
209 uint32_t num_features_;
211 uint32_t 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_
const MicroFeature * micro_features() const
void DisplayFeatures(ScrollView::Color color, ScrollView *window) const
#define ELISTIZEH(CLASSNAME)
void set_max_dist(double value)
void set_is_error(bool value)
int geo_feature(int index) const
static TrainingSample * CopyFromFeatures(const INT_FX_RESULT_STRUCT &fx_info, const TBOX &bounding_box, const INT_FEATURE_STRUCT *features, int num_features)
float cn_feature(int index) const
TrainingSample * Copy() const
void ExtractCharDesc(int feature_type, int micro_type, int cn_type, int geo_type, CHAR_DESC_STRUCT *char_desc)
static TrainingSample * DeSerializeCreate(bool swap, FILE *fp)
Pix * GetSamplePix(int padding, Pix *page_pix) const
uint32_t num_micro_features() const
void set_weight(double value)
const TBOX & bounding_box() const
const INT_FEATURE_STRUCT * features() const
const GenericVector< int > & mapped_features() const
uint32_t num_features() const
float MicroFeature[MFCount]
bool Serialize(FILE *fp) const
FEATURE_STRUCT * GetCNFeature() const
void set_sample_index(int value)
void set_bounding_box(const TBOX &box)
void MapFeatures(const IntFeatureMap &feature_map)
int outline_length() const
Pix * RenderToPix(const UNICHARSET *unicharset) const
bool DeSerialize(bool swap, FILE *fp)
void set_class_id(int id)
void set_page_num(int page)
bool features_are_mapped() const
void IndexFeatures(const IntFeatureSpace &feature_space)
UNICHAR_ID class_id() const
const GenericVector< int > & indexed_features() const
TrainingSample * RandomizedCopy(int index) const