src/textord/textlineprojection.cpp
int TextlineProjection::BestMeanGradientInColumn(const DENORM *denorm, int16_t x, int16_t min_y,
                                                 int16_t max_y, bool best_is_max) const {
  TPOINT start_pt(x, min_y);
  TPOINT end_pt(x, max_y);
  int left = MeanPixelsInLineSegment(denorm, -2, start_pt, end_pt);
  int right = MeanPixelsInLineSegment(denorm, 2, start_pt, end_pt);
  int best_gradient = right - left;
  left = MeanPixelsInLineSegment(denorm, -1, start_pt, end_pt);
  right = MeanPixelsInLineSegment(denorm, 3, start_pt, end_pt);
  int gradient = right - left;
  if ((gradient > best_gradient) == best_is_max) {
    best_gradient = gradient;
  }
  left = MeanPixelsInLineSegment(denorm, -3, start_pt, end_pt);
  right = MeanPixelsInLineSegment(denorm, 1, start_pt, end_pt);
  gradient = right - left;
  if ((gradient > best_gradient) == best_is_max) {
    best_gradient = gradient;
  }
  return best_gradient;
}
// Helper returns the mean gradient value for the vertical column at the
// given x, (in the external coordinates) by subtracting the mean of the
// transformed column 2 pixels left from the mean of the transformed column
// 2 pixels to the right.
// This gives a positive value for a good left edge and negative for right.
// Returns the best result out of +2/-2, +3/-1, +1/-3 pixels from the edge.
Helper returns the mean gradient value for the vertical column at the
given x, (in the external coordinates) by subtracting the mean of the
transformed column 2 pixels left from the mean of the transformed column
2 pixels to the right.
This gives a positive value for a good left edge and negative for right.
Returns the best result out of +2/-2, +3/-1, +1/-3 pixels from the edge.
Helper returns the mean gradient value for the vertical column at the given x ( in the external coordinates ) by subtracting the mean of the transformed column 2 pixels left from the mean of the transformed column 2 pixels to the right . This gives a positive value for a good left edge and negative for right . Returns the best result out of + 2 / - 2 + 3 / - 1 + 1 / - 3 pixels from the edge .
int TextlineProjection::BestMeanGradientInColumn(const DENORM *denorm, int16_t x, int16_t min_y,
                                                 int16_t max_y, bool best_is_max) const {
  TPOINT start_pt(x, min_y);
  TPOINT end_pt(x, max_y);
  int left = MeanPixelsInLineSegment(denorm, -2, start_pt, end_pt);
  int right = MeanPixelsInLineSegment(denorm, 2, start_pt, end_pt);
  int best_gradient = right - left;
  left = MeanPixelsInLineSegment(denorm, -1, start_pt, end_pt);
  right = MeanPixelsInLineSegment(denorm, 3, start_pt, end_pt);
  int gradient = right - left;
  if ((gradient > best_gradient) == best_is_max) {
    best_gradient = gradient;
  }
  left = MeanPixelsInLineSegment(denorm, -3, start_pt, end_pt);
  right = MeanPixelsInLineSegment(denorm, 1, start_pt, end_pt);
  gradient = right - left;
  if ((gradient > best_gradient) == best_is_max) {
    best_gradient = gradient;
  }
  return best_gradient;
}
int TextlineProjection :: BestMeanGradientInColumn ( const DENORM * denorm , int16_t x , int16_t min_y , int16_t max_y , bool best_is_max ) const { TPOINT start_pt ( x , min_y ) ; TPOINT end_pt ( x , max_y ) ; int left = MeanPixelsInLineSegment ( denorm , -2 , start_pt , end_pt ) ; int right = MeanPixelsInLineSegment ( denorm , 2 , start_pt , end_pt ) ; int best_gradient = right - left ; left = MeanPixelsInLineSegment ( denorm , -1 , start_pt , end_pt ) ; right = MeanPixelsInLineSegment ( denorm , 3 , start_pt , end_pt ) ; int gradient = right - left ; if ( ( gradient > best_gradient ) == best_is_max ) { best_gradient = gradient ; } left = MeanPixelsInLineSegment ( denorm , -3 , start_pt , end_pt ) ; right = MeanPixelsInLineSegment ( denorm , 1 , start_pt , end_pt ) ; gradient = right - left ; if ( ( gradient > best_gradient ) == best_is_max ) { best_gradient = gradient ; } return best_gradient ; }
Helper returns the mean gradient value for the vertical column at the
given x, (in the external coordinates) by subtracting the mean of the
transformed column 2 pixels left from the mean of the transformed column
2 pixels to the right.
Helper returns the mean gradient value for the vertical column at the given x ( in the external coordinates ) by subtracting the mean of the transformed column 2 pixels left from the mean of the transformed column 2 pixels to the right .