43 CharSamp(
int left,
int top,
int wid,
int hgt);
46 unsigned short Left()
const {
return left_; }
47 unsigned short Right()
const {
return left_ +
wid_; }
48 unsigned short Top()
const {
return top_; }
50 unsigned short Page()
const {
return page_; }
51 unsigned short NormTop()
const {
return norm_top_; }
52 unsigned short NormBottom()
const {
return norm_bottom_; }
54 unsigned short FirstChar()
const {
return first_char_; }
55 unsigned short LastChar()
const {
return last_char_; }
57 if (label32_ == NULL ||
LabelLen() != 1) {
65 void SetLeft(
unsigned short left) { left_ = left; }
66 void SetTop(
unsigned short top) { top_ = top; }
67 void SetPage(
unsigned short page) { page_ = page; }
77 if (label32 != NULL) {
79 if (label32[0] == 0xfeff) {
83 label32_ =
new char_32[len + 1];
84 memcpy(label32_, label32, len *
sizeof(*label32));
89 void SetNormTop(
unsigned short norm_top) { norm_top_ = norm_top; }
91 norm_bottom_ = norm_bottom;
94 norm_aspect_ratio_ = norm_aspect_ratio;
97 first_char_ = first_char;
100 last_char_ = last_char;
111 ConComp **
Segment(
int *seg_cnt,
bool right_2_left,
int max_hist_wnd,
112 int min_con_comp_size)
const;
125 unsigned char *data);
127 int strt_concomp,
int seg_flags_size,
128 int *seg_flags,
bool *left_most,
129 bool *right_most,
int word_hgt);
134 if (label32 == NULL) {
138 while (label32[++len] != 0);
143 unsigned short page_;
144 unsigned short left_;
147 unsigned short norm_top_;
149 unsigned short norm_bottom_;
151 unsigned short norm_aspect_ratio_;
152 unsigned short first_char_;
153 unsigned short last_char_;
158 #endif // CHAR_SAMP_H unsigned short LastChar() const
static int LabelLen(const char_32 *label32)
void SetPage(unsigned short page)
char_32 * StrLabel() const
void SetTop(unsigned short top)
CharSamp * Scale(int wid, int hgt, bool isotropic=true)
unsigned short NormAspectRatio() const
void SetFirstChar(unsigned short first_char)
void SetNormAspectRatio(unsigned short norm_aspect_ratio)
bool Save2CharDumpFile(FILE *fp) const
static CharSamp * FromCharDumpFile(CachedFile *fp)
bool ComputeFeatures(int conv_grid_size, float *features)
unsigned short NormTop() const
unsigned short Right() const
void SetLabel(char_32 label)
unsigned short Top() const
ConComp ** Segment(int *seg_cnt, bool right_2_left, int max_hist_wnd, int min_con_comp_size) const
void SetNormBottom(unsigned short norm_bottom)
string stringLabel() const
unsigned short FirstChar() const
static CharSamp * FromRawData(int left, int top, int wid, int hgt, unsigned char *data)
unsigned short Page() const
unsigned short NormBottom() const
void SetNormTop(unsigned short norm_top)
unsigned short Left() const
static CharSamp * FromConComps(ConComp **concomp_array, int strt_concomp, int seg_flags_size, int *seg_flags, bool *left_most, bool *right_most, int word_hgt)
void SetLastChar(unsigned short last_char)
static int AuxFeatureCnt()
unsigned short Bottom() const
void SetLeft(unsigned short left)
void SetLabel(const char_32 *label32)