20 #ifndef TESSERACT_CCSTRUCT_LINLSQ_H_ 21 #define TESSERACT_CCSTRUCT_LINLSQ_H_ 34 void add(
double x,
double y);
36 void add(
double x,
double y,
double weight);
40 void remove(
double x,
double y);
42 return static_cast<int>(total_weight + 0.5);
46 double c(
double m)
const;
47 double rms(
double m,
double c)
const;
74 if (total_weight > 0.0)
75 return (sigxy - sigx * sigy / total_weight) / total_weight;
80 if (total_weight > 0.0)
81 return (sigxx - sigx * sigx / total_weight) / total_weight;
86 if (total_weight > 0.0)
87 return (sigyy - sigy * sigy / total_weight) / total_weight;
113 T halfrange =
static_cast<T
>(modulus / 2);
114 int num_elements = v->
size();
115 for (
int i = 0; i < num_elements; ++i) {
116 stats.
add((*v)[i], (*v)[i] + halfrange);
120 for (
int i = 0; i < num_elements; ++i) {
121 (*v)[i] += halfrange;
126 for (
int i = 0; i < num_elements; ++i) {
127 (*v)[i] -= halfrange;
130 return (*v)[median_index];
134 #endif // TESSERACT_CCSTRUCT_LINLSQ_H_ double covariance() const
double y_variance() const
double rms(double m, double c) const
double rms_orth(const FCOORD &dir) const
void add(double x, double y)
T MedianOfCircularValues(T modulus, GenericVector< T > *v)
double x_variance() const
FCOORD vector_fit() const
int choose_nth_item(int target_index)
FCOORD mean_point() const