tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
107 return static_cast<BlobNeighbourDir>(dir ^ 2);
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();
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,
481 left_crossing_rule_ = 0;
482 right_crossing_rule_ = 0;
483 if (area_stroke_width_ == 0.0f && area > 0 &&
cblob() !=
nullptr
484 &&
cblob()->perimeter()!=0)
487 base_char_top_ = box.
top();
488 base_char_bottom_ = box.
bottom();
489 baseline_y_ = box.
bottom();
491 base_char_blob_ =
nullptr;
492 horz_possible_ =
false;
493 vert_possible_ =
false;
494 leader_on_left_ =
false;
495 leader_on_right_ =
false;
501 neighbours_[n] =
nullptr;
502 good_stroke_neighbours_[n] =
false;
507 C_BLOB* cblob_ptr =
nullptr;
511 int32_t repeated_set_ = 0;
518 bool reduced =
false;
519 int16_t left_rule_ = 0;
520 int16_t right_rule_ = 0;
521 int16_t left_crossing_rule_;
522 int16_t right_crossing_rule_;
523 int16_t base_char_top_;
524 int16_t base_char_bottom_;
526 int32_t line_crossings_;
530 float horz_stroke_width_ = 0.0f;
531 float vert_stroke_width_ = 0.0f;
532 float area_stroke_width_ = 0.0f;
536 bool leader_on_left_;
537 bool leader_on_right_;
541 bool owns_cblob_ =
false;
559 float max_y()
const {
562 float min_y()
const {
566 return (y_min + y_max) / 2.0f;
569 return initial_y_min;
617 para_error = new_error;
618 credibility = blobs.length() -
kErrorWeight * new_error;
619 y_origin = new_c / std::sqrt(1 + gradient * gradient);
632 return num_repeated_sets_ != -1;
635 num_repeated_sets_ = -1;
638 return num_repeated_sets_;
641 num_repeated_sets_ = num_sets;
686 int num_repeated_sets_;
713 for (BLOBNBOX_LIST** list = blobnbox_list; *list !=
nullptr; ++list) {
714 BLOBNBOX_IT it(*list);
715 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
716 it.data()->rotate(rotation);
725 BLOBNBOX_IT blob_it(&
blobs);
726 for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
727 widths.add(blob_it.data()->bounding_box().width(), 1);
728 heights.add(blob_it.data()->bounding_box().height(), 1);
731 static_cast<int>(heights.median() + 0.5));
735 TO_ROW_IT row_it = &row_list;
738 for (row_it.mark_cycle_pt(); !row_it.cycled_list();
741 tprintf(
"Row range (%g,%g), para_c=%g, blobcount=%" PRId32
"\n",
765 #ifndef GRAPHICS_DISABLED
801 TO_ROW_LIST row_list;
806 "Weighting for error in believability");
844 #ifndef GRAPHICS_DISABLED
849 #endif // GRAPHICS_DISABLED
void ComputeEdgeOffsets(Pix *thresholds, Pix *grey)
void find_cblob_limits(C_BLOB *blob, float leftx, float rightx, FCOORD rotation, float &ymin, float &ymax)
void set_num_repeated_sets(int num_sets)
BLOBNBOX_LIST small_blobs
void plot_graded_blobs(ScrollView *to_win)
TBOX box_next(BLOBNBOX_IT *it)
void set_right_tab_type(TabType new_type)
static void ComputeEdgeOffsets(Pix *thresholds, Pix *grey, BLOBNBOX_LIST *blobs)
TBOX bounding_box() const
void move(const ICOORD vec)
void rotate_box(FCOORD rotation)
bool DominatesInMerge(BlobTextFlowType type1, BlobTextFlowType type2)
int NoisyNeighbours() const
void plot_noise_blobs(ScrollView *to_win)
void set_diacritic_box(const TBOX &diacritic_box)
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
void set_bounding_box(const TBOX &new_box)
BLOBNBOX_LIST noise_blobs
void set_repeated_set(int set_id)
void plot(ScrollView *window, ScrollView::Color blob_colour, ScrollView::Color child_colour)
static void PlotBlobs(BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour, ScrollView *win)
static bool IsImageType(BlobRegionType type)
BLOBNBOX * base_char_blob() const
TBOX BoundsWithinLimits(int left, int right)
void set_parallel_line(float gradient, float new_c, float new_error)
void vertical_coutline_projection(C_OUTLINE *outline, STATS *stats)
int base_char_top() const
void clear_rep_chars_marked()
int line_crossings() const
TBOX box_next_pre_chopped(BLOBNBOX_IT *it)
void set_flow(BlobTextFlowType value)
void find_cblob_vlimits(C_BLOB *blob, float leftx, float rightx, float &ymin, float &ymax)
bool leader_on_left() const
void set_vert_stroke_width(float width)
void compute_bounding_box()
void DeleteUnownedNoise()
void set_special_text_type(BlobSpecialTextType new_type)
void translate_box(ICOORD v)
void NeighbourGaps(int gaps[BND_COUNT]) const
static BLOBNBOX * RealBlob(C_OUTLINE *outline)
bool good_stroke_neighbour(BlobNeighbourDir n) const
PITCH_TYPE pitch_decision
#define double_VAR_H(name, val, comment)
void reflect_box_in_y_axis()
void set_left_tab_type(TabType new_type)
#define ELISTIZEH(CLASSNAME)
static bool UnMergeableType(BlobRegionType type)
ScrollView::Color BoxColor() const
void set_line_crossings(int value)
float horz_stroke_width() const
void set_median_size(int x, int y)
void rotate(const FCOORD &rotation)
static ScrollView::Color TextlineColor(BlobRegionType region_type, BlobTextFlowType flow_type)
static bool IsLineType(BlobRegionType type)
BlobSpecialTextType special_text_type() const
float initial_min_y() const
BLOBNBOX * neighbour(BlobNeighbourDir n) const
int left_crossing_rule() const
#define ELIST2IZEH(CLASSNAME)
float parallel_error() const
bool rep_chars_marked() const
void ReSetAndReFilterBlobs()
void set_base_char_blob(BLOBNBOX *blob)
PDBLK pdblk
Page Description Block.
void set_owns_cblob(bool value)
int base_char_bottom() const
bool leader_on_right() const
BLOBNBOX_LIST large_blobs
void insert_blob(BLOBNBOX *blob)
POLY_BLOCK * poly_block() const
static void PlotNoiseBlobs(BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour, ScrollView *win)
bool MatchingStrokeWidth(const BLOBNBOX &other, double fractional_tolerance, double constant_tolerance) const
int num_repeated_sets() const
bool joined_to_prev() const
void set_left_rule(int new_left)
void set_leader_on_right(bool flag)
static const int kErrorWeight
bool vert_possible() const
void set_right_crossing_rule(int new_right)
void set_leader_on_left(bool flag)
void set_owner(tesseract::ColPartition *new_owner)
void set_left_crossing_rule(int new_left)
bool DefiniteIndividualFlow()
void rotate(FCOORD rotation)
void set_neighbour(BlobNeighbourDir n, BLOBNBOX *neighbour, bool good)
void set_region_type(BlobRegionType new_type)
PITCH_TYPE pitch_decision
void add_blob(BLOBNBOX *blob, float top, float bottom, float row_size)
const TBOX & bounding_box() const
bool UniquelyVertical() const
void set_reduced_box(TBOX new_box)
bool DeletableNoise() const
double textord_error_weight
void rotate(const FCOORD &rotation)
float area_stroke_width() const
TabType right_tab_type() const
int baseline_position() const
void merge(BLOBNBOX *nextblob)
void really_merge(BLOBNBOX *other)
int32_t enclosed_area() const
void EstimateBaselinePosition()
BlobTextFlowType flow() const
float believability() const
bool horz_possible() const
int right_crossing_rule() const
void set_horz_stroke_width(float width)
bool ConfirmNoTabViolation(const BLOBNBOX &other) const
BlobRegionType region_type() const
void set_horz_possible(bool value)
BlobNeighbourDir DirOtherWay(BlobNeighbourDir dir)
void MinMaxGapsClipped(int *h_min, int *h_max, int *v_min, int *v_max) const
DLLSYM void tprintf(const char *format,...)
ICOORDELT_LIST char_cells
void set_line(float new_m, float new_c, float new_error)
void vertical_cblob_projection(C_BLOB *blob, STATS *stats)
tesseract::ColPartition * owner() const
const TBOX & reduced_box() const
static bool IsTextType(BlobRegionType type)
TabType left_tab_type() const
void set_limits(float new_min, float new_max)
void plot_blob_list(ScrollView *win, BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour)
float vert_stroke_width() const
void chop(BLOBNBOX_IT *start_it, BLOBNBOX_IT *blob_it, FCOORD rotation, float xheight)
C_BLOB * crotate_cblob(C_BLOB *blob, FCOORD rotation)
static void DeleteNoiseBlobs(BLOBNBOX_LIST *blobs)
void compute_vertical_projection()
bool UniquelyHorizontal() const
BLOBNBOX_LIST * blob_list()
int16_t y() const
access_function
void set_vert_possible(bool value)
void find_cblob_hlimits(C_BLOB *blob, float bottomy, float topy, float &xmin, float &xymax)
void set_right_rule(int new_right)