19#ifndef TESSERACT_TEXTORD_BASELINEDETECT_H_
20#define TESSERACT_TEXTORD_BASELINEDETECT_H_
78 void SetupBlobDisplacements(
const FCOORD &direction);
90 void FitConstrainedIfBetter(
int debug,
const FCOORD &direction,
double cheat_allowance,
91 double target_offset);
94 float PerpDistanceFromBaseline(
const FCOORD &pt)
const;
96 void ComputeBoundingBox();
101 BLOBNBOX_LIST *blobs_;
110 std::vector<double> displacement_modes_;
112 double disp_quant_factor_;
115 double fit_halfrange_;
117 double max_baseline_error_;
119 double baseline_error_;
130 for (
auto row : rows_) {
144 static double SpacingModelError(
double perp_disp,
double line_spacing,
double line_offset);
190 bool ComputeLineSpacing();
194 void ComputeBaselinePositions(
const FCOORD &direction, std::vector<double> *positions);
198 void EstimateLineSpacing();
204 void RefineLineSpacing(
const std::vector<double> &positions);
210 double FitLineSpacingModel(
const std::vector<double> &positions,
double m_in,
double *m_out,
211 double *c_out,
int *index_delta);
217 std::vector<BaselineRow *> rows_;
221 bool non_text_block_;
224 bool good_skew_angle_;
228 double line_spacing_;
244 for (
auto block : blocks_) {
260 bool remove_noise,
bool show_final_rows,
Textord *textord);
269 std::vector<BaselineBlock *> blocks_;
bool FitBaseline(bool use_box_bottoms)
double PerpDisp(const FCOORD &direction) const
const TBOX & bounding_box() const
double BaselineAngle() const
void AdjustBaselineToParallel(int debug, const FCOORD &direction)
double SpaceBetween(const BaselineRow &other) const
BaselineRow(double line_size, TO_ROW *to_row)
double StraightYAtX(double x) const
double AdjustBaselineToGrid(int debug, const FCOORD &direction, double line_spacing, double line_offset)
void SetupOldLineParameters(TO_ROW *row) const
void SetupBlockParameters() const
double skew_angle() const
void FitBaselineSplines(bool enable_splines, bool show_final_rows, Textord *textord)
bool FitBaselinesAndFindSkew(bool use_box_bottoms)
BaselineBlock(int debug_level, bool non_text, TO_BLOCK *block)
void DrawFinalRows(const ICOORD &page_tr)
void ParallelizeBaselines(double default_block_skew)
void DrawPixSpline(Image pix_in)
void PrepareForSplineFitting(ICOORD page_tr, bool remove_noise)
static double SpacingModelError(double perp_disp, double line_spacing, double line_offset)
BaselineDetect(int debug_level, const FCOORD &page_skew, TO_BLOCK_LIST *blocks)
void ComputeBaselineSplinesAndXheights(const ICOORD &page_tr, bool enable_splines, bool remove_noise, bool show_final_rows, Textord *textord)
void ComputeStraightBaselines(bool use_box_bottoms)