tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
57 void LLSQ::add(
double x,
double y,
double weight) {
58 total_weight += weight;
61 sigxx += x * x * weight;
62 sigxy += x * y * weight;
63 sigyy += y * y * weight;
67 total_weight += other.total_weight;
83 if (total_weight <= 0.0)
104 return covar / x_var;
116 double LLSQ::c(
double m)
const {
117 if (total_weight > 0.0)
118 return (sigy -
m * sigx) / total_weight;
130 double LLSQ::rms(
double m,
double c)
const {
133 if (total_weight > 0) {
134 error = sigyy +
m * (
m * sigxx + 2 * (
c * sigx - sigxy)) +
c *
135 (total_weight *
c - 2 * sigy);
137 error = std::sqrt(error / total_weight);
159 if (var_product > 0.0)
160 r = covar / std::sqrt(var_product);
167 if (total_weight > 0.0) {
168 return FCOORD(sigx / total_weight, sigy / total_weight);
170 return FCOORD(0.0f, 0.0f);
255 double theta = 0.5 * atan2(2.0 * covar, x_var - y_var);
256 FCOORD result(cos(theta), sin(theta));
void add(double x, double y)
double y_variance() const
FCOORD vector_fit() const
FCOORD mean_point() const
void remove(double x, double y)
double rms(double m, double c) const
double rms_orth(const FCOORD &dir) const
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
double covariance() const
bool normalise()
Convert to unit vec.
constexpr ERRCODE EMPTY_LLSQ("Can't delete from an empty LLSQ")
double x_variance() const