84 if (char_samp->NormBottom() <= 0) {
87 unsigned char *raw_data = char_samp->RawData();
88 int stride = char_samp->Stride();
90 int word_hgt = (255 * (char_samp->Top() + char_samp->Height()) /
91 char_samp->NormBottom());
93 vector<float> left_profile(word_hgt, 0.0);
94 vector<float> right_profile(word_hgt, 0.0);
95 unsigned char *line_data = raw_data;
96 for (
int y = 0; y < char_samp->Height(); y++, line_data += stride) {
97 int min_x = char_samp->Width();
99 for (
int x = 0; x < char_samp->Width(); x++) {
100 if (line_data[x] == 0) {
104 left_profile[char_samp->Top() + y] =
105 1.0 * (min_x == char_samp->Width() ? 0 : (min_x + 1)) /
107 right_profile[char_samp->Top() + y] =
108 1.0 * (max_x == -1 ? 0 : char_samp->Width() - max_x) /
113 vector<float> top_profile(char_samp->Width(), 0);
114 vector<float> bottom_profile(char_samp->Width(), 0);
115 for (
int x = 0; x < char_samp->Width(); x++) {
116 int min_y = word_hgt;
118 line_data = raw_data;
119 for (
int y = 0; y < char_samp->Height(); y++, line_data += stride) {
120 if (line_data[x] == 0) {
124 top_profile[x] = 1.0 * (min_y == word_hgt ? 0 : (min_y + 1)) / word_hgt;
125 bottom_profile[x] = 1.0 * (max_y == -1 ? 0 : (word_hgt - max_y)) / word_hgt;
void UpdateRange(const T1 &x, T2 *lower_bound, T2 *upper_bound)
static const int kChebychevCoefficientCnt
void ChebyshevCoefficients(const vector< float > &input, int coeff_cnt, float *coeff)