134 return type1 >= type2;
153 area =
static_cast<int>(srcblob->
area());
156 if (owns_cblob_)
delete cblob_ptr;
159 auto* blob =
new C_BLOB(outline);
177 base_char_top_ += v.
y();
178 base_char_bottom_ += v.
y();
187 BLOBNBOX_IT *start_it,
188 BLOBNBOX_IT *blob_it,
194 int* v_min,
int* v_max)
const;
218 double fractional_tolerance,
219 double constant_tolerance)
const;
237 base_char_top_ = box.
top();
238 base_char_bottom_ = box.bottom();
241 box = cblob_ptr->bounding_box();
242 base_char_top_ = box.top();
243 base_char_bottom_ = box.bottom();
244 baseline_y_ = box.bottom();
263 return repeated_set_;
266 repeated_set_ = set_id;
272 return left_tab_type_;
275 left_tab_type_ = new_type;
278 return right_tab_type_;
281 right_tab_type_ = new_type;
287 region_type_ = new_type;
293 spt_type_ = new_type;
302 return vert_possible_;
305 vert_possible_ = value;
308 return horz_possible_;
311 horz_possible_ = value;
317 left_rule_ = new_left;
323 right_rule_ = new_right;
326 return left_crossing_rule_;
329 left_crossing_rule_ = new_left;
332 return right_crossing_rule_;
335 right_crossing_rule_ = new_right;
338 return horz_stroke_width_;
341 horz_stroke_width_ = width;
344 return vert_stroke_width_;
347 vert_stroke_width_ = width;
350 return area_stroke_width_;
359 return leader_on_left_;
362 leader_on_left_ = flag;
365 return leader_on_right_;
368 leader_on_right_ = flag;
371 return neighbours_[n];
374 return good_stroke_neighbours_[n];
378 good_stroke_neighbours_[n] = good;
381 return base_char_top_ != box.top() || base_char_bottom_ != box.bottom();
384 return base_char_top_;
387 return base_char_bottom_;
393 return line_crossings_;
396 line_crossings_ = value;
399 base_char_top_ = diacritic_box.
top();
400 base_char_bottom_ = diacritic_box.
bottom();
403 return base_char_blob_;
406 base_char_blob_ = blob;
411 return vert_possible_ && !horz_possible_;
414 return horz_possible_ && !vert_possible_;
440 BLOBNBOX_LIST* blobs);
442 #ifndef GRAPHICS_DISABLED 445 static void PlotBlobs(BLOBNBOX_LIST* list,
474 area_stroke_width_ = 0.0f;
475 horz_stroke_width_ = 0.0f;
476 vert_stroke_width_ = 0.0f;
492 left_crossing_rule_ = 0;
493 right_crossing_rule_ = 0;
494 if (area_stroke_width_ == 0.0f && area > 0 &&
cblob() !=
nullptr 495 &&
cblob()->perimeter()!=0)
498 base_char_top_ = box.top();
499 base_char_bottom_ = box.bottom();
500 baseline_y_ = box.bottom();
502 base_char_blob_ =
nullptr;
503 horz_possible_ =
false;
504 vert_possible_ =
false;
505 leader_on_left_ =
false;
506 leader_on_right_ =
false;
512 neighbours_[n] =
nullptr;
513 good_stroke_neighbours_[n] =
false;
523 unsigned reduced : 1;
531 int16_t left_crossing_rule_;
532 int16_t right_crossing_rule_;
533 int16_t base_char_top_;
534 int16_t base_char_bottom_;
538 float horz_stroke_width_;
539 float vert_stroke_width_;
540 float area_stroke_width_;
547 bool leader_on_left_;
548 bool leader_on_right_;
558 static const int kErrorWeight = 3;
577 return (y_min + y_max) / 2.0f;
580 return initial_y_min;
628 para_error = new_error;
629 credibility = blobs.length() - kErrorWeight * new_error;
630 y_origin = new_c / std::sqrt(1 + gradient * gradient);
639 void compute_vertical_projection();
643 return num_repeated_sets_ != -1;
646 num_repeated_sets_ = -1;
649 return num_repeated_sets_;
652 num_repeated_sets_ = num_sets;
697 int num_repeated_sets_;
722 BLOBNBOX_LIST* blobnbox_list[] = {&blobs, &underlines, &noise_blobs,
723 &small_blobs, &large_blobs,
nullptr};
724 for (BLOBNBOX_LIST** list = blobnbox_list; *list !=
nullptr; ++list) {
725 BLOBNBOX_IT it(*list);
726 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
727 it.data()->rotate(rotation);
732 block->rotate(rotation);
734 STATS widths(0, block->pdblk.bounding_box().width());
735 STATS heights(0, block->pdblk.bounding_box().height());
736 BLOBNBOX_IT blob_it(&blobs);
737 for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
738 widths.add(blob_it.data()->bounding_box().width(), 1);
739 heights.add(blob_it.data()->bounding_box().height(), 1);
741 block->set_median_size(static_cast<int>(widths.median() + 0.5),
742 static_cast<int>(heights.median() + 0.5));
746 TO_ROW_IT row_it = &row_list;
749 for (row_it.mark_cycle_pt(); !row_it.cycled_list();
752 tprintf(
"Row range (%g,%g), para_c=%g, blobcount=%" PRId32
"\n",
762 void ReSetAndReFilterBlobs();
765 void DeleteUnownedNoise();
774 void ComputeEdgeOffsets(Pix* thresholds, Pix* grey);
776 #ifndef GRAPHICS_DISABLED 812 TO_ROW_LIST row_list;
817 "Weighting for error in believability");
855 #ifndef GRAPHICS_DISABLED 860 #endif // GRAPHICS_DISABLED
void set_owns_cblob(bool value)
void set_parallel_line(float gradient, float new_c, float new_error)
void set_leader_on_right(bool flag)
void reflect_box_in_y_axis()
TabType right_tab_type() const
TBOX box_next_pre_chopped(BLOBNBOX_IT *it)
PITCH_TYPE pitch_decision
void set_vert_possible(bool value)
void set_right_tab_type(TabType new_type)
void set_base_char_blob(BLOBNBOX *blob)
void find_cblob_vlimits(C_BLOB *blob, float leftx, float rightx, float &ymin, float &ymax)
int line_crossings() const
void set_right_crossing_rule(int new_right)
static BLOBNBOX * RealBlob(C_OUTLINE *outline)
int num_repeated_sets() const
void vertical_coutline_projection(C_OUTLINE *outline, STATS *stats)
tesseract::ColPartition * owner() const
static void PlotBlobs(BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour, ScrollView *win)
void set_neighbour(BlobNeighbourDir n, BLOBNBOX *neighbour, bool good)
static ScrollView::Color TextlineColor(BlobRegionType region_type, BlobTextFlowType flow_type)
void set_line(float new_m, float new_c, float new_error)
void set_diacritic_box(const TBOX &diacritic_box)
TBOX BoundsWithinLimits(int left, int right)
bool DeletableNoise() const
void set_horz_stroke_width(float width)
BLOBNBOX_LIST noise_blobs
const TBOX & bounding_box() const
int16_t y() const
access_function
int base_char_bottom() const
PITCH_TYPE pitch_decision
TBOX bounding_box() const
BlobTextFlowType flow() const
#define double_VAR_H(name, val, comment)
void set_left_rule(int new_left)
void find_cblob_limits(C_BLOB *blob, float leftx, float rightx, FCOORD rotation, float &ymin, float &ymax)
void set_line_crossings(int value)
void set_horz_possible(bool value)
int baseline_position() const
void rotate(FCOORD rotation)
BLOBNBOX_LIST small_blobs
static bool IsLineType(BlobRegionType type)
bool rep_chars_marked() const
void MinMaxGapsClipped(int *h_min, int *h_max, int *v_min, int *v_max) const
int NoisyNeighbours() const
float horz_stroke_width() const
ScrollView::Color BoxColor() const
void really_merge(BLOBNBOX *other)
TBOX box_next(BLOBNBOX_IT *it)
static void DeleteNoiseBlobs(BLOBNBOX_LIST *blobs)
void compute_bounding_box()
void set_left_crossing_rule(int new_left)
bool leader_on_right() const
void merge(BLOBNBOX *nextblob)
bool ConfirmNoTabViolation(const BLOBNBOX &other) const
void vertical_cblob_projection(C_BLOB *blob, STATS *stats)
void set_limits(float new_min, float new_max)
void set_bounding_box(const TBOX &new_box)
bool MatchingStrokeWidth(const BLOBNBOX &other, double fractional_tolerance, double constant_tolerance) const
void set_owner(tesseract::ColPartition *new_owner)
bool vert_possible() const
void rotate_box(FCOORD rotation)
TabType left_tab_type() const
DLLSYM void tprintf(const char *format,...)
double textord_error_weight
BLOBNBOX * base_char_blob() const
static bool UnMergeableType(BlobRegionType type)
static bool IsImageType(BlobRegionType type)
int32_t enclosed_area() const
const TBOX & reduced_box() const
void rotate(const FCOORD &rotation)
void find_cblob_hlimits(C_BLOB *blob, float bottomy, float topy, float &xmin, float &xymax)
#define ELISTIZEH(CLASSNAME)
bool DominatesInMerge(BlobTextFlowType type1, BlobTextFlowType type2)
BlobRegionType region_type() const
BLOBNBOX * neighbour(BlobNeighbourDir n) const
static bool IsTextType(BlobRegionType type)
BLOBNBOX_LIST * blob_list()
void plot_blob_list(ScrollView *win, BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour)
void set_vert_stroke_width(float width)
void set_reduced_box(TBOX new_box)
#define ELIST2IZEH(CLASSNAME)
bool DefiniteIndividualFlow()
void set_region_type(BlobRegionType new_type)
BlobSpecialTextType special_text_type() const
bool horz_possible() const
void EstimateBaselinePosition()
void set_flow(BlobTextFlowType value)
float believability() const
float parallel_error() const
BLOBNBOX_LIST large_blobs
int right_crossing_rule() const
void clear_rep_chars_marked()
void set_leader_on_left(bool flag)
void set_right_rule(int new_right)
void chop(BLOBNBOX_IT *start_it, BLOBNBOX_IT *blob_it, FCOORD rotation, float xheight)
bool UniquelyHorizontal() const
void set_left_tab_type(TabType new_type)
BLOBNBOX(C_BLOB *srcblob)
C_BLOB * crotate_cblob(C_BLOB *blob, FCOORD rotation)
static void ComputeEdgeOffsets(Pix *thresholds, Pix *grey, BLOBNBOX_LIST *blobs)
void translate_box(ICOORD v)
bool UniquelyVertical() const
float area_stroke_width() const
float initial_min_y() const
void plot(ScrollView *window, ScrollView::Color blob_colour, ScrollView::Color child_colour)
void set_repeated_set(int set_id)
void set_special_text_type(BlobSpecialTextType new_type)
static void PlotNoiseBlobs(BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour, ScrollView *win)
ICOORDELT_LIST char_cells
BlobNeighbourDir DirOtherWay(BlobNeighbourDir dir)
void NeighbourGaps(int gaps[BND_COUNT]) const
float vert_stroke_width() const
int left_crossing_rule() const
int base_char_top() const
bool joined_to_prev() const
bool leader_on_left() const
bool good_stroke_neighbour(BlobNeighbourDir n) const
void set_num_repeated_sets(int num_sets)