tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
23 #include "config_auto.h"
54 edgept = edgept->
next;
59 edgept = edgept->
next;
68 edgept = edgept->
next;
73 edgept = edgept->
next;
81 int centered_maxwidth,
double center_knob,
82 double width_change_knob)
const {
85 int min_left = std::min(box1.
left(), box2.
left());
86 int max_right = std::max(box1.
right(), box2.
right());
87 if (xmin < min_left && xmax > max_right)
return kBadPriority;
91 int width1 = box1.
width();
92 int width2 = box2.
width();
93 int min_width = std::min(width1, width2);
94 int overlap = -box1.
x_gap(box2);
95 if (overlap == min_width) {
98 if (2 * overlap > min_width) overlap += 2 * overlap - min_width;
99 if (overlap > 0) grade += overlap_knob * overlap;
102 if (width1 <= centered_maxwidth || width2 <= centered_maxwidth) {
103 grade += std::min(static_cast<double>(
kCenterGradeCap), center_knob * abs(width1 - width2));
106 float width_change_grade = 20 - (max_right - min_left - std::max(width1, width2));
107 if (width_change_grade > 0.0f)
108 grade += width_change_grade * width_change_knob;
142 this_edgept->
pos.
x = x;
143 this_edgept->
pos.
y = y;
146 if (prev_ol !=
nullptr && prev->
next == next) {
150 double cut_fraction = target_vec.
length() / segment_vec.
length();
156 ICOORD step_vec = step_end - step_start;
157 double target_length = step_vec.
length() * cut_fraction;
161 double best_dist = target_length;
162 for (
int s = prev->
start_step; s < end_step; ++s) {
163 total_step += prev_ol->
step(s % step_length);
164 double dist = fabs(target_length - total_step.
length());
165 if (dist < best_dist) {
172 this_edgept->
step_count = end_step - best_step;
173 this_edgept->
start_step = best_step % step_length;
182 this_edgept->
next = next;
183 this_edgept->
prev = prev;
184 prev->
next = this_edgept;
185 next->
prev = this_edgept;
223 #ifndef GRAPHICS_DISABLED
236 while (outlines->
next !=
nullptr) outlines = outlines->
next;
242 outlines = outlines->
next;
int SegmentArea(const EDGEPT *end) const
bool IsHealthy(const TBLOB &blob, int min_points, int min_area) const
void ComputeBoundingBox()
void SplitOutlineList(TESSLINE *outlines) const
bool EqualPos(const EDGEPT &other) const
bool IsLittleChunk(int min_points, int min_area) const
const int kCenterGradeCap
float length() const
find length
const double kBadPriority
ICOORD position_at_index(int index) const
void remove_edgept(EDGEPT *point)
float length() const
find length
void Mark(ScrollView *window) const
void UnsplitOutlines() const
EDGEPT * make_edgept(int x, int y, EDGEPT *next, EDGEPT *prev)
#define BOOL_VAR(name, val, comment)
float FullPriority(int xmin, int xmax, double overlap_knob, int centered_maxwidth, double center_knob, double width_change_knob) const
bool ShortNonCircularSegment(int min_points, const EDGEPT *end) const
bool wordrec_display_splits
void UnsplitOutlineList(TBLOB *blob) const
void SplitOutline() const
TBOX bounding_box() const
void Line(int x1, int y1, int x2, int y2)
DLLSYM void tprintf(const char *format,...)
int32_t pathlength() const
ICOORD step(int index) const
int x_gap(const TBOX &box) const
bool SegmentCrossesOutline(const TPOINT &pt1, const TPOINT &pt2) const