38 #include "config_auto.h"
44 #define SPLIT_CLOSENESS 20
46 #define MAX_NUM_SEAMS 150
48 #define MAX_OLD_SEAMS 150
49 #define NO_FULL_PRIORITY -1
51 #define BAD_PRIORITY 9999.0
66 if (new_seam ==
NULL)
return;
68 tprintf(
"Pushing new seam with priority %g :", new_priority);
69 new_seam->
Print(
"seam: ");
73 if (seams->
PopWorst(&old_pair) && old_pair.
key() <= new_priority) {
75 tprintf(
"Old seam staying with priority %g\n", old_pair.
key());
78 seams->
Push(&old_pair);
81 tprintf(
"New seam with priority %g beats old worst seam with %g\n",
82 new_priority, old_pair.
key());
85 SeamPair new_pair(new_priority, new_seam);
86 seams->
Push(&new_pair);
110 my_priority = priority;
115 seam =
new SEAM(my_priority, split_point, *split);
125 while (!seam_queue->
empty()) {
127 seam_queue->
Pop(&seam_pair);
134 sprintf (str,
"Full my_priority %0.0f, ", my_priority);
138 if ((*seam_result ==
NULL || (*seam_result)->priority() > my_priority) &&
144 *seam_result =
new SEAM(*seam);
145 (*seam_result)->set_priority(my_priority);
164 seam_pile->
Push(&pair);
167 seam_pile->
PeekTop().key() > seam_pair.
key()) {
170 seam_pile->
Pop(&pair);
175 seam_pile->
Push(&pair);
199 for (
int x = 0; x < seam_pile.
size(); ++x) {
200 const SEAM *this_one = seam_pile.
get(x).data();
219 EDGEPT_CLIST new_points;
222 inT16 num_points = 0;
224 #ifndef GRAPHICS_DISABLED
232 for (outline = blob->
outlines; outline; outline = outline->
next)
236 points[num_points++] = point_heap.
PeekTop().data;
243 try_point_pairs(points, num_points, &seam_queue, &seam_pile, &seam, blob);
245 &seam_queue, &seam_pile, &seam, blob);
254 EDGEPT_C_IT it(&new_points);
255 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
256 EDGEPT *inserted_point = it.data();
258 for (outline = blob->
outlines; outline; outline = outline->
next) {
259 if (outline->
loop == inserted_point) {
272 #ifndef GRAPHICS_DISABLED
307 for (x = 0; x < num_points; x++) {
308 for (y = x + 1; y < num_points; y++) {
312 points[x] != points[y]->next && points[y] != points[x]->next &&
315 SPLIT split(points[x], points[y]);
337 EDGEPT_CLIST *new_points,
347 for (x = 0; x < num_points; x++) {
348 vertical_point =
NULL;
349 for (outline = blob->
outlines; outline; outline = outline->
next) {
351 &vertical_point, new_points);
354 if (vertical_point && points[x] != vertical_point->
next &&
355 vertical_point != points[x]->
next &&
358 SPLIT split(points[x], vertical_point);
#define partial_split_priority(split)
bool wordrec_display_splits
int chop_min_outline_points
float FullPriority(int xmin, int xmax, double overlap_knob, int centered_maxwidth, double center_knob, double width_change_knob) const
int WeightedDistance(const EDGEPT &other, int x_factor) const
void Print(const char *label) const
void remove_edgept(EDGEPT *point)
#define is_exterior_point(edge, point)
double chop_width_change_knob
void Mark(ScrollView *window) const
bool IsHealthy(const TBLOB &blob, int min_points, int min_area) const
void add_seam_to_queue(float new_priority, SEAM *new_seam, SeamQueue *seams)
void vertical_projection_point(EDGEPT *split_point, EDGEPT *target_point, EDGEPT **best_point, EDGEPT_CLIST *new_points)
void choose_best_seam(SeamQueue *seam_queue, const SPLIT *split, PRIORITY priority, SEAM **seam_result, TBLOB *blob, SeamPile *seam_pile)
bool CombineableWith(const SEAM &other, int max_x_dist, float max_total_priority) const
#define update_edge_window()
void try_point_pairs(EDGEPT *points[MAX_NUM_POINTS], inT16 num_points, SeamQueue *seam_queue, SeamPile *seam_pile, SEAM **seam, TBLOB *blob)
SEAM * pick_good_seam(TBLOB *blob)
const Pair & get(int index) const
int chop_centered_maxwidth
void set_key(const Key &new_key)
void CombineWith(const SEAM &other)
void set_data(Data *new_data)
const Pair & PeekTop() const
bool PopWorst(Pair *entry)
bool UsesPoint(const EDGEPT *point) const
void draw_blob_edges(TBLOB *blob)
void prioritize_points(TESSLINE *outline, PointHeap *points)
void try_vertical_splits(EDGEPT *points[MAX_NUM_POINTS], inT16 num_points, EDGEPT_CLIST *new_points, SeamQueue *seam_queue, SeamPile *seam_pile, SEAM **seam, TBLOB *blob)
int chop_min_outline_area
TBOX bounding_box() const
#define edge_window_wait()
void combine_seam(const SeamPile &seam_pile, const SEAM *seam, SeamQueue *seam_queue)