16#ifndef TESSERACT_TRAINING_TRAININGSAMPLE_H_
17#define TESSERACT_TRAINING_TRAININGSAMPLE_H_
39static const int kNumCNParams = 4;
41static const int kSampleYShiftSize = 5;
43static const int kSampleScaleSize = 3;
51static const int kSampleRandomSize = kSampleYShiftSize * kSampleScaleSize - 2;
57 : class_id_(INVALID_UNICHAR_ID)
61 , num_micro_features_(0)
64 , micro_features_(nullptr)
68 , features_are_indexed_(false)
69 , features_are_mapped_(false)
76 const TBOX &bounding_box,
100 void ExtractCharDesc(
int feature_type,
int micro_type,
int cn_type,
int geo_type,
116 Image GetSamplePix(
int padding,
Image page_pix)
const;
138 return bounding_box_;
144 return num_features_;
150 return num_micro_features_;
153 return micro_features_;
156 return outline_length_;
159 return cn_feature_[index];
162 return geo_feature_[index];
177 return sample_index_;
180 sample_index_ =
value;
183 return features_are_mapped_;
187 return mapped_features_;
191 return mapped_features_;
212 uint32_t num_features_;
214 uint32_t num_micro_features_;
224 float cn_feature_[kNumCNParams];
252 static const int kYShiftValues[kSampleYShiftSize];
253 static const double kScaleValues[kSampleScaleSize];
#define ELISTIZEH(CLASSNAME)
bool DeSerialize(bool swap, FILE *fp, std::vector< T > &data)
bool Serialize(FILE *fp, const std::vector< T > &data)
std::array< float,(int) MicroFeatureParameter::MFCount > MicroFeature
const INT_FEATURE_STRUCT * features() const
const TBOX & bounding_box() const
void set_max_dist(double value)
const std::vector< int > & mapped_features() const
UNICHAR_ID class_id() const
uint32_t num_features() const
bool features_are_mapped_
void set_page_num(int page)
const std::vector< int > & indexed_features() const
void set_class_id(int id)
void set_weight(double value)
uint32_t num_micro_features() const
int outline_length() const
int geo_feature(int index) const
void set_is_error(bool value)
float cn_feature(int index) const
const MicroFeature * micro_features() const
bool features_are_mapped() const
void set_bounding_box(const TBOX &box)
std::vector< int > mapped_features_
bool features_are_indexed_
void set_sample_index(int value)