#include <linlsq.h>
Definition at line 28 of file linlsq.h.
◆ LLSQ()
◆ add() [1/3]
void LLSQ::add |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
◆ add() [2/3]
void LLSQ::add |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
weight |
|
) |
| |
Definition at line 57 of file linlsq.cpp.
58 total_weight += weight;
61 sigxx += x * x * weight;
62 sigxy += x * y * weight;
63 sigyy += y * y * weight;
◆ add() [3/3]
void LLSQ::add |
( |
const LLSQ & |
other | ) |
|
Definition at line 66 of file linlsq.cpp.
67 total_weight += other.total_weight;
◆ c()
double LLSQ::c |
( |
double |
m | ) |
const |
Definition at line 116 of file linlsq.cpp.
117 if (total_weight > 0.0)
118 return (sigy -
m * sigx) / total_weight;
◆ clear()
◆ count()
int32_t LLSQ::count |
( |
| ) |
const |
|
inline |
Definition at line 43 of file linlsq.h.
44 return static_cast<int>(total_weight + 0.5);
◆ covariance()
double LLSQ::covariance |
( |
| ) |
const |
|
inline |
Definition at line 75 of file linlsq.h.
76 if (total_weight > 0.0)
77 return (sigxy - sigx * sigy / total_weight) / total_weight;
◆ m()
Definition at line 100 of file linlsq.cpp.
104 return covar / x_var;
double covariance() const
double x_variance() const
◆ mean_point()
FCOORD LLSQ::mean_point |
( |
| ) |
const |
Definition at line 166 of file linlsq.cpp.
167 if (total_weight > 0.0) {
168 return FCOORD(sigx / total_weight, sigy / total_weight);
170 return FCOORD(0.0f, 0.0f);
◆ pearson()
double LLSQ::pearson |
( |
| ) |
const |
Definition at line 153 of file linlsq.cpp.
159 if (var_product > 0.0)
160 r = covar / std::sqrt(var_product);
double covariance() const
double y_variance() const
double x_variance() const
◆ remove()
void LLSQ::remove |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
Definition at line 82 of file linlsq.cpp.
83 if (total_weight <= 0.0)
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
◆ rms()
double LLSQ::rms |
( |
double |
m, |
|
|
double |
c |
|
) |
| const |
Definition at line 130 of file linlsq.cpp.
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);
◆ rms_orth()
double LLSQ::rms_orth |
( |
const FCOORD & |
dir | ) |
const |
Definition at line 195 of file linlsq.cpp.
bool normalise()
Convert to unit vec.
double covariance() const
double y_variance() const
double x_variance() const
◆ vector_fit()
FCOORD LLSQ::vector_fit |
( |
| ) |
const |
Definition at line 251 of file linlsq.cpp.
255 double theta = 0.5 * atan2(2.0 * covar, x_var - y_var);
256 FCOORD result(cos(theta), sin(theta));
double covariance() const
double y_variance() const
double x_variance() const
◆ x_variance()
double LLSQ::x_variance |
( |
| ) |
const |
|
inline |
Definition at line 81 of file linlsq.h.
82 if (total_weight > 0.0)
83 return (sigxx - sigx * sigx / total_weight) / total_weight;
◆ y_variance()
double LLSQ::y_variance |
( |
| ) |
const |
|
inline |
Definition at line 87 of file linlsq.h.
88 if (total_weight > 0.0)
89 return (sigyy - sigy * sigy / total_weight) / total_weight;
The documentation for this class was generated from the following files:
- /usr/src/tesseract-ocr.master/src/ccstruct/linlsq.h
- /usr/src/tesseract-ocr.master/src/ccstruct/linlsq.cpp