135 return type1 >= type2;
154 area =
static_cast<int>(srcblob->
area());
157 if (owns_cblob_)
delete cblob_ptr;
178 base_char_top_ += v.
y();
179 base_char_bottom_ += v.
y();
188 BLOBNBOX_IT *start_it,
189 BLOBNBOX_IT *blob_it,
195 int* v_min,
int* v_max)
const;
219 double fractional_tolerance,
220 double constant_tolerance)
const;
238 base_char_top_ = box.
top();
239 base_char_bottom_ = box.bottom();
242 box = cblob_ptr->bounding_box();
243 base_char_top_ = box.top();
244 base_char_bottom_ = box.bottom();
245 baseline_y_ = box.bottom();
264 return repeated_set_;
267 repeated_set_ = set_id;
273 return left_tab_type_;
276 left_tab_type_ = new_type;
279 return right_tab_type_;
282 right_tab_type_ = new_type;
288 region_type_ = new_type;
294 spt_type_ = new_type;
303 return vert_possible_;
306 vert_possible_ = value;
309 return horz_possible_;
312 horz_possible_ = value;
318 left_rule_ = new_left;
324 right_rule_ = new_right;
327 return left_crossing_rule_;
330 left_crossing_rule_ = new_left;
333 return right_crossing_rule_;
336 right_crossing_rule_ = new_right;
339 return horz_stroke_width_;
342 horz_stroke_width_ = width;
345 return vert_stroke_width_;
348 vert_stroke_width_ = width;
351 return area_stroke_width_;
360 return leader_on_left_;
363 leader_on_left_ = flag;
366 return leader_on_right_;
369 leader_on_right_ = flag;
372 return neighbours_[n];
375 return good_stroke_neighbours_[n];
379 good_stroke_neighbours_[n] = good;
382 return base_char_top_ != box.top() || base_char_bottom_ != box.bottom();
385 return base_char_top_;
388 return base_char_bottom_;
394 return line_crossings_;
397 line_crossings_ = value;
400 base_char_top_ = diacritic_box.
top();
401 base_char_bottom_ = diacritic_box.
bottom();
404 return base_char_blob_;
407 base_char_blob_ = blob;
412 return vert_possible_ && !horz_possible_;
415 return horz_possible_ && !vert_possible_;
441 BLOBNBOX_LIST* blobs);
443 #ifndef GRAPHICS_DISABLED 446 static void PlotBlobs(BLOBNBOX_LIST* list,
475 area_stroke_width_ = 0.0f;
476 horz_stroke_width_ = 0.0f;
477 vert_stroke_width_ = 0.0f;
493 left_crossing_rule_ = 0;
494 right_crossing_rule_ = 0;
495 if (area_stroke_width_ == 0.0f && area > 0 &&
cblob() !=
nullptr 496 &&
cblob()->perimeter()!=0)
499 base_char_top_ = box.top();
500 base_char_bottom_ = box.bottom();
501 baseline_y_ = box.bottom();
503 base_char_blob_ =
nullptr;
504 horz_possible_ =
false;
505 vert_possible_ =
false;
506 leader_on_left_ =
false;
507 leader_on_right_ =
false;
513 neighbours_[n] =
nullptr;
514 good_stroke_neighbours_[n] =
false;
524 unsigned reduced : 1;
532 int16_t left_crossing_rule_;
533 int16_t right_crossing_rule_;
534 int16_t base_char_top_;
535 int16_t base_char_bottom_;
539 float horz_stroke_width_;
540 float vert_stroke_width_;
541 float area_stroke_width_;
548 bool leader_on_left_;
549 bool leader_on_right_;
578 return (y_min + y_max) / 2.0f;
581 return initial_y_min;
629 para_error = new_error;
632 y_origin = (float) (new_c / sqrt (1 + gradient * gradient));
645 return num_repeated_sets_ != -1;
648 num_repeated_sets_ = -1;
651 return num_repeated_sets_;
654 num_repeated_sets_ = num_sets;
699 int num_repeated_sets_;
724 BLOBNBOX_LIST* blobnbox_list[] = {&blobs, &underlines, &noise_blobs,
725 &small_blobs, &large_blobs,
nullptr};
726 for (BLOBNBOX_LIST** list = blobnbox_list; *list !=
nullptr; ++list) {
727 BLOBNBOX_IT it(*list);
728 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
729 it.data()->rotate(rotation);
734 block->rotate(rotation);
736 STATS widths(0, block->pdblk.bounding_box().width());
737 STATS heights(0, block->pdblk.bounding_box().height());
738 BLOBNBOX_IT blob_it(&blobs);
739 for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
740 widths.add(blob_it.data()->bounding_box().width(), 1);
741 heights.add(blob_it.data()->bounding_box().height(), 1);
743 block->set_median_size(static_cast<int>(widths.median() + 0.5),
744 static_cast<int>(heights.median() + 0.5));
748 TO_ROW_IT row_it = &row_list;
751 for (row_it.mark_cycle_pt(); !row_it.cycled_list();
754 tprintf(
"Row range (%g,%g), para_c=%g, blobcount=%" PRId32
"\n",
764 void ReSetAndReFilterBlobs();
767 void DeleteUnownedNoise();
776 void ComputeEdgeOffsets(Pix* thresholds, Pix* grey);
778 #ifndef GRAPHICS_DISABLED 814 TO_ROW_LIST row_list;
819 "Weighting for error in believability");
857 #ifndef GRAPHICS_DISABLED 862 #endif // GRAPHICS_DISABLED
float area_stroke_width() const
bool DeletableNoise() const
void set_repeated_set(int set_id)
void set_vert_possible(bool value)
void insert_blob(BLOBNBOX *blob)
bool DefiniteIndividualFlow()
static void PlotBlobs(BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour, ScrollView *win)
void compute_vertical_projection()
ICOORDELT_LIST char_cells
#define ELISTIZEH(CLASSNAME)
float horz_stroke_width() const
const TBOX & reduced_box() const
int NoisyNeighbours() const
void find_cblob_limits(C_BLOB *blob, float leftx, float rightx, FCOORD rotation, float &ymin, float &ymax)
void set_diacritic_box(const TBOX &diacritic_box)
void set_leader_on_right(bool flag)
int num_repeated_sets() const
static void PlotNoiseBlobs(BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour, ScrollView *win)
int right_crossing_rule() const
void set_horz_stroke_width(float width)
void add_blob(BLOBNBOX *blob, float top, float bottom, float row_size)
TBOX BoundsWithinLimits(int left, int right)
double textord_error_weight
int16_t y() const
access_function
int32_t enclosed_area() const
void vertical_coutline_projection(C_OUTLINE *outline, STATS *stats)
void set_owns_cblob(bool value)
#define double_VAR_H(name, val, comment)
BlobTextFlowType flow() const
void set_base_char_blob(BLOBNBOX *blob)
static bool IsImageType(BlobRegionType type)
static bool UnMergeableType(BlobRegionType type)
BLOBNBOX(C_BLOB *srcblob)
void merge(BLOBNBOX *nextblob)
void rotate(const FCOORD &rotation)
void plot(ScrollView *window, ScrollView::Color blob_colour, ScrollView::Color child_colour)
int base_char_top() const
void set_vert_stroke_width(float width)
void MinMaxGapsClipped(int *h_min, int *h_max, int *v_min, int *v_max) const
void set_left_rule(int new_left)
void find_cblob_vlimits(C_BLOB *blob, float leftx, float rightx, float &ymin, float &ymax)
int left_crossing_rule() const
void set_left_crossing_rule(int new_left)
void set_num_repeated_sets(int num_sets)
void plot_blob_list(ScrollView *win, BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour)
void set_right_tab_type(TabType new_type)
void set_neighbour(BlobNeighbourDir n, BLOBNBOX *neighbour, bool good)
int base_char_bottom() const
void clear_rep_chars_marked()
void set_right_rule(int new_right)
int line_crossings() const
void set_line(float new_m, float new_c, float new_error)
void set_reduced_box(TBOX new_box)
C_BLOB * crotate_cblob(C_BLOB *blob, FCOORD rotation)
bool DominatesInMerge(BlobTextFlowType type1, BlobTextFlowType type2)
void reflect_box_in_y_axis()
void set_horz_possible(bool value)
void rotate_box(FCOORD rotation)
void translate_box(ICOORD v)
void set_bounding_box(const TBOX &new_box)
void find_cblob_hlimits(C_BLOB *blob, float bottomy, float topy, float &xmin, float &xymax)
static const int kErrorWeight
void set_region_type(BlobRegionType new_type)
bool UniquelyHorizontal() const
bool leader_on_right() const
PITCH_TYPE pitch_decision
void set_parallel_line(float gradient, float new_c, float new_error)
void vertical_cblob_projection(C_BLOB *blob, STATS *stats)
static BLOBNBOX * RealBlob(C_OUTLINE *outline)
void set_owner(tesseract::ColPartition *new_owner)
bool good_stroke_neighbour(BlobNeighbourDir n) const
void set_limits(float new_min, float new_max)
bool horz_possible() const
bool rep_chars_marked() const
void EstimateBaselinePosition()
BlobRegionType region_type() const
float parallel_error() const
bool joined_to_prev() const
#define ELIST2IZEH(CLASSNAME)
TabType right_tab_type() const
void NeighbourGaps(int gaps[BND_COUNT]) const
BLOBNBOX * base_char_blob() const
TabType left_tab_type() const
BlobSpecialTextType special_text_type() const
DLLSYM void tprintf(const char *format,...)
float vert_stroke_width() const
float initial_min_y() const
void chop(BLOBNBOX_IT *start_it, BLOBNBOX_IT *blob_it, FCOORD rotation, float xheight)
static void ComputeEdgeOffsets(Pix *thresholds, Pix *grey, BLOBNBOX_LIST *blobs)
EXTERN ScrollView * to_win
void set_flow(BlobTextFlowType value)
BlobNeighbourDir DirOtherWay(BlobNeighbourDir dir)
void set_leader_on_left(bool flag)
bool vert_possible() const
TBOX bounding_box() const
float believability() const
const TBOX & bounding_box() const
void rotate(FCOORD rotation)
bool ConfirmNoTabViolation(const BLOBNBOX &other) const
bool leader_on_left() const
int baseline_position() const
ScrollView::Color BoxColor() const
tesseract::ColPartition * owner() const
static void DeleteNoiseBlobs(BLOBNBOX_LIST *blobs)
BLOBNBOX_LIST large_blobs
bool UniquelyVertical() const
TBOX box_next(BLOBNBOX_IT *it)
BLOBNBOX * neighbour(BlobNeighbourDir n) const
void set_left_tab_type(TabType new_type)
void set_right_crossing_rule(int new_right)
void really_merge(BLOBNBOX *other)
BLOBNBOX_LIST * blob_list()
TBOX box_next_pre_chopped(BLOBNBOX_IT *it)
void compute_bounding_box()
BLOBNBOX_LIST small_blobs
bool MatchingStrokeWidth(const BLOBNBOX &other, double fractional_tolerance, double constant_tolerance) const
BLOBNBOX_LIST noise_blobs
static bool IsTextType(BlobRegionType type)
static bool IsLineType(BlobRegionType type)
PITCH_TYPE pitch_decision
void set_special_text_type(BlobSpecialTextType new_type)
void set_line_crossings(int value)
static ScrollView::Color TextlineColor(BlobRegionType region_type, BlobTextFlowType flow_type)