19#ifndef TESSERACT_CCSTRUCT_DETLINEFIT_H_
20#define TESSERACT_CCSTRUCT_DETLINEFIT_H_
69 void Add(
const ICOORD &pt,
int halfwidth);
74 return Fit(0, 0, pt1, pt2);
97 double Fit(
float *m,
float *c);
110 PointWidth() : pt(
ICOORD(0, 0)), halfwidth(0) {}
111 PointWidth(
const ICOORD &pt0,
int halfwidth0) : pt(pt0), halfwidth(halfwidth0) {}
119 using DistPointPair = KDPairInc<double, ICOORD>;
122 double EvaluateLineFit();
126 double ComputeUpperQuartileError();
129 int NumberOfMisfittedPoints(
double threshold)
const;
135 void ComputeDistances(
const ICOORD &start,
const ICOORD &end);
140 void ComputeConstrainedDistances(
const FCOORD &direction,
double min_dist,
double max_dist);
144 std::vector<PointWidth> pts_;
150 std::vector<DistPointPair> distances_;
152 double square_length_;
void Add(const ICOORD &pt)
double ConstrainedFit(const FCOORD &direction, double min_dist, double max_dist, bool debug, ICOORD *line_pt)
double Fit(ICOORD *pt1, ICOORD *pt2)
bool SufficientPointsForIndependentFit() const