#include <detlinefit.h>
Definition at line 54 of file detlinefit.h.
| tesseract::DetLineFit::DetLineFit |
( |
| ) |
|
| tesseract::DetLineFit::~DetLineFit |
( |
| ) |
|
| void tesseract::DetLineFit::Add |
( |
const ICOORD & |
pt | ) |
|
Definition at line 41 of file detlinefit.cpp.
42 ICOORDELT_IT it = &pt_list_;
44 it.add_to_end(new_pt);
| void tesseract::DetLineFit::Clear |
( |
| ) |
|
| double tesseract::DetLineFit::ConstrainedFit |
( |
double |
m, |
|
|
float * |
c |
|
) |
| |
Definition at line 159 of file detlinefit.cpp.
160 ICOORDELT_IT it(&pt_list_);
162 if (pt_list_.empty()) {
170 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
172 pts[pt_count] = it.data();
176 pts[kNumEndPoints + i - 1] = pts[kNumEndPoints + i];
177 pts[kNumEndPoints * 2 - 1] = it.data();
182 pts[pt_count] =
NULL;
185 int* distances =
new int[pt_count];
186 double best_uq = -1.0;
190 if (start ==
NULL)
continue;
193 double dist = ComputeErrors(*start, end, distances);
194 if (dist < best_uq || best_uq < 0.0) {
196 *c = start->
y() - start->
x() * m;
201 return best_uq > 0.0 ? sqrt(best_uq) : best_uq;
inT16 x() const
access function
inT16 y() const
access_function
ICOORD ComputeEndFromGradient(const ICOORD &start, double m)
| double tesseract::DetLineFit::Fit |
( |
ICOORD * |
pt1, |
|
|
ICOORD * |
pt2 |
|
) |
| |
Definition at line 49 of file detlinefit.cpp.
50 ICOORDELT_IT it(&pt_list_);
52 if (pt_list_.empty()) {
62 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
64 starts[pt_count] = it.data();
65 ends[pt_count] = starts[pt_count];
68 ends[i - 1] = ends[i];
69 ends[kNumEndPoints - 1] = it.data();
83 int* distances =
new int[pt_count];
84 double best_uq = -1.0;
86 for (
int i = 0; i < end_count; ++i) {
88 for (
int j = 0; j < end_count; ++j) {
92 double dist = ComputeErrors(*start, *end, distances);
93 if (dist < best_uq || best_uq < 0.0) {
103 return best_uq > 0.0 ? sqrt(best_uq) : best_uq;
void set_y(inT16 yin)
rewrite function
void set_x(inT16 xin)
rewrite function
| double tesseract::DetLineFit::Fit |
( |
float * |
m, |
|
|
float * |
c |
|
) |
| |
Definition at line 109 of file detlinefit.cpp.
111 double error =
Fit(&start, &end);
112 if (end.
x() != start.
x()) {
113 *m =
static_cast<float>(end.
y() - start.
y()) / (end.
x() - start.
x());
114 *c = start.
y() - *m * start.
x();
inT16 x() const
access function
double Fit(ICOORD *pt1, ICOORD *pt2)
inT16 y() const
access_function
The documentation for this class was generated from the following files:
- /home/abuild/rpmbuild/BUILD/tesseract-ocr-3.02.02/ccstruct/detlinefit.h
- /home/abuild/rpmbuild/BUILD/tesseract-ocr-3.02.02/ccstruct/detlinefit.cpp