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