#include <quadlsq.h>
Definition at line 25 of file quadlsq.h.
◆ QLSQ()
◆ add()
void QLSQ::add |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
Definition at line 56 of file quadlsq.cpp.
63 sigxxx +=
static_cast<long double>(x) * x * x;
64 sigxxy +=
static_cast<long double>(x) * x * y;
65 sigxxxx +=
static_cast<long double>(x) * x * x * x;
◆ clear()
◆ count()
◆ fit()
void QLSQ::fit |
( |
int |
degree | ) |
|
Definition at line 100 of file quadlsq.cpp.
101 long double x_variance =
static_cast<long double>(sigxx) * n -
102 static_cast<long double>(sigx) * sigx;
108 if (x_variance <
kMinVariance * n * n || degree < 1 || n < 2) {
111 if (n >= 1 && degree >= 0) {
118 long double top96 = 0.0;
119 long double bottom96 = 0.0;
120 long double cubevar = sigxxx * n -
static_cast<long double>(sigxx) * sigx;
121 long double covariance =
static_cast<long double>(sigxy) * n -
122 static_cast<long double>(sigx) * sigy;
124 if (n >= 4 && degree >= 2) {
125 top96 = cubevar * covariance;
126 top96 += x_variance * (
static_cast<long double>(sigxx) * sigy - sigxxy * n);
128 bottom96 = cubevar * cubevar;
129 bottom96 -= x_variance *
130 (sigxxxx * n -
static_cast<long double>(sigxx) * sigxx);
134 a = top96 / bottom96;
135 top96 = covariance - cubevar * a;
136 b = top96 / x_variance;
140 b = covariance / x_variance;
142 c = (sigy - a * sigxx - b * sigx) / n;
const double kMinVariance
◆ get_a()
◆ get_b()
◆ get_c()
◆ remove()
void QLSQ::remove |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
Definition at line 75 of file quadlsq.cpp.
77 tprintf(
"Can't remove an element from an empty QLSQ accumulator!\n");
86 sigxxx -=
static_cast<long double>(x) * x * x;
87 sigxxy -=
static_cast<long double>(x) * x * y;
88 sigxxxx -=
static_cast<long double>(x) * x * x * x;
DLLSYM void tprintf(const char *format,...)
The documentation for this class was generated from the following files:
- /usr/src/tesseract-ocr.master/src/ccstruct/quadlsq.h
- /usr/src/tesseract-ocr.master/src/ccstruct/quadlsq.cpp