20 #ifndef TESSERACT_CLASSIFY_INTFEATURESPACE_H_ 21 #define TESSERACT_CLASSIFY_INTFEATURESPACE_H_ 23 #include "genericvector.h" 27 const int kIntFeatureExtent = 256;
29 const int kBoostXYBuckets = 16;
30 const int kBoostDirBuckets = 16;
44 void Init(uint8_t xbuckets, uint8_t ybuckets, uint8_t thetabuckets);
80 int bucket = x *
x_buckets_ / kIntFeatureExtent;
81 return ClipToRange(bucket, 0, static_cast<int>(
x_buckets_) - 1);
84 int bucket = y *
y_buckets_ / kIntFeatureExtent;
85 return ClipToRange(bucket, 0, static_cast<int>(
y_buckets_) - 1);
90 int bucket = DivRounded(theta *
theta_buckets_, kIntFeatureExtent);
91 return Modulo(bucket, theta_buckets_);
104 #endif // TESSERACT_CLASSIFY_INTFEATURESPACE_H_ Definition: intfeaturespace.h:38
uint8_t y_buckets_
Definition: intfeaturespace.h:98
int XBucket(int x) const
Definition: intfeaturespace.h:79
uint8_t Y
Definition: intproto.h:141
IntFeatureSpace()
Definition: intfeaturespace.cpp:25
INT_FEATURE_STRUCT PositionFromBuckets(int x, int y, int theta) const
Definition: intfeaturespace.cpp:113
uint8_t x_buckets_
Definition: intfeaturespace.h:97
uint8_t theta_buckets_
Definition: intfeaturespace.h:99
Definition: baseapi.cpp:94
void IndexAndSortFeatures(const INT_FEATURE_STRUCT *features, int num_features, GenericVector< int > *sorted_features) const
Definition: intfeaturespace.cpp:67
uint8_t X
Definition: intproto.h:140
int Size() const
Definition: intfeaturespace.h:51
int Index(const INT_FEATURE_STRUCT &f) const
Definition: intfeaturespace.h:60
void Init(uint8_t xbuckets, uint8_t ybuckets, uint8_t thetabuckets)
Definition: intfeaturespace.cpp:29
void IndexFeatures(const INT_FEATURE_STRUCT *features, int num_features, GenericVector< int > *mapped_features) const
Definition: intfeaturespace.cpp:57
int XYToFeatureIndex(int x, int y) const
Definition: intfeaturespace.cpp:78
bool Serialize(FILE *fp) const
Definition: intfeaturespace.cpp:37
uint8_t Theta
Definition: intproto.h:142
Definition: intproto.h:132
int YBucket(int y) const
Definition: intfeaturespace.h:83
INT_FEATURE_STRUCT PositionFromIndex(int index) const
Definition: intfeaturespace.cpp:49
int ThetaBucket(int theta) const
Definition: intfeaturespace.h:89