tesseract  5.0.0-alpha-619-ge9db
blobs.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * File: blobs.h
4  * Description: Blob definition
5  * Author: Mark Seaman, OCR Technology
6  *
7  * (c) Copyright 1989, Hewlett-Packard Company.
8  ** Licensed under the Apache License, Version 2.0 (the "License");
9  ** you may not use this file except in compliance with the License.
10  ** You may obtain a copy of the License at
11  ** http://www.apache.org/licenses/LICENSE-2.0
12  ** Unless required by applicable law or agreed to in writing, software
13  ** distributed under the License is distributed on an "AS IS" BASIS,
14  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  ** See the License for the specific language governing permissions and
16  ** limitations under the License.
17  *
18  *****************************************************************************/
19 
20 #ifndef BLOBS_H
21 #define BLOBS_H
22 
23 /*----------------------------------------------------------------------
24  I n c l u d e s
25 ----------------------------------------------------------------------*/
26 #include <cstdint> // for int16_t
27 #include <cstring> // for memcpy, memset
28 #include "clst.h" // for CLIST_ITERATOR, CLISTIZEH
29 #include <tesseract/genericvector.h> // for GenericVector
30 #include "normalis.h" // for DENORM
31 #include "points.h" // for FCOORD, ICOORD
32 #include <tesseract/publictypes.h> // for OcrEngineMode
33 #include "rect.h" // for TBOX
34 #include "scrollview.h" // for ScrollView, ScrollView::Color
35 
36 class BLOCK;
37 class C_BLOB;
38 class C_OUTLINE;
39 class LLSQ;
40 class ROW;
41 class WERD;
42 
43 struct Pix;
44 
45 /*----------------------------------------------------------------------
46  T y p e s
47 ----------------------------------------------------------------------*/
48 #define EDGEPTFLAGS 4 /*concavity,length etc. */
49 
50 struct TPOINT {
51  TPOINT(): x(0), y(0) {}
52  TPOINT(int16_t vx, int16_t vy) : x(vx), y(vy) {}
53  TPOINT(const ICOORD &ic) : x(ic.x()), y(ic.y()) {}
54 
55  void operator+=(const TPOINT& other) {
56  x += other.x;
57  y += other.y;
58  }
59  void operator/=(int divisor) {
60  x /= divisor;
61  y /= divisor;
62  }
63  bool operator==(const TPOINT& other) const {
64  return x == other.x && y == other.y;
65  }
66  // Returns true when the two line segments cross each other.
67  // (Moved from outlines.cpp).
68  static bool IsCrossed(const TPOINT& a0, const TPOINT& a1, const TPOINT& b0,
69  const TPOINT& b1);
70 
71  // Assign the difference from point p1 to point p2.
72  void diff(const TPOINT& p1, const TPOINT& p2) {
73  x = p1.x - p2.x;
74  y = p1.y - p2.y;
75  }
76 
77  // Return cross product.
78  int cross(const TPOINT& other) const {
79  return x * other.y - y * other.x;
80  }
81 
82  // Return scalar or dot product.
83  int dot(const TPOINT& other) const {
84  return x * other.x + y * other.y;
85  }
86 
87  // Calculate length of vector.
88  int length() const {
89  return x * x + y * y;
90  }
91 
92  int16_t x; // absolute x coord.
93  int16_t y; // absolute y coord.
94 };
95 
96 using VECTOR = TPOINT; // structure for coordinates.
97 
98 struct EDGEPT {
99  EDGEPT()
100  : next(nullptr), prev(nullptr), src_outline(nullptr), start_step(0), step_count(0) {
101  memset(flags, 0, EDGEPTFLAGS * sizeof(flags[0]));
102  }
103  EDGEPT(const EDGEPT& src) : next(nullptr), prev(nullptr) {
104  CopyFrom(src);
105  }
106  EDGEPT& operator=(const EDGEPT& src) {
107  CopyFrom(src);
108  return *this;
109  }
110  // Copies the data elements, but leaves the pointers untouched.
111  void CopyFrom(const EDGEPT& src) {
112  pos = src.pos;
113  vec = src.vec;
114  memcpy(flags, src.flags, EDGEPTFLAGS * sizeof(flags[0]));
115  src_outline = src.src_outline;
116  start_step = src.start_step;
117  step_count = src.step_count;
118  }
119  // Returns the squared distance between the points, with the x-component
120  // weighted by x_factor.
121  int WeightedDistance(const EDGEPT& other, int x_factor) const {
122  int x_dist = pos.x - other.pos.x;
123  int y_dist = pos.y - other.pos.y;
124  return x_dist * x_dist * x_factor + y_dist * y_dist;
125  }
126  // Returns true if the positions are equal.
127  bool EqualPos(const EDGEPT& other) const { return pos == other.pos; }
128  // Returns the bounding box of the outline segment from *this to *end.
129  // Ignores hidden edge flags.
130  TBOX SegmentBox(const EDGEPT* end) const {
131  TBOX box(pos.x, pos.y, pos.x, pos.y);
132  const EDGEPT* pt = this;
133  do {
134  pt = pt->next;
135  if (pt->pos.x < box.left()) box.set_left(pt->pos.x);
136  if (pt->pos.x > box.right()) box.set_right(pt->pos.x);
137  if (pt->pos.y < box.bottom()) box.set_bottom(pt->pos.y);
138  if (pt->pos.y > box.top()) box.set_top(pt->pos.y);
139  } while (pt != end && pt != this);
140  return box;
141  }
142  // Returns the area of the outline segment from *this to *end.
143  // Ignores hidden edge flags.
144  int SegmentArea(const EDGEPT* end) const {
145  int area = 0;
146  const EDGEPT* pt = this->next;
147  do {
148  TPOINT origin_vec(pt->pos.x - pos.x, pt->pos.y - pos.y);
149  area += origin_vec.cross(pt->vec);
150  pt = pt->next;
151  } while (pt != end && pt != this);
152  return area;
153  }
154  // Returns true if the number of points in the outline segment from *this to
155  // *end is less that min_points and false if we get back to *this first.
156  // Ignores hidden edge flags.
157  bool ShortNonCircularSegment(int min_points, const EDGEPT* end) const {
158  int count = 0;
159  const EDGEPT* pt = this;
160  do {
161  if (pt == end) return true;
162  pt = pt->next;
163  ++count;
164  } while (pt != this && count <= min_points);
165  return false;
166  }
167 
168  // Accessors to hide or reveal a cut edge from feature extractors.
169  void Hide() {
170  flags[0] = true;
171  }
172  void Reveal() {
173  flags[0] = false;
174  }
175  bool IsHidden() const {
176  return flags[0] != 0;
177  }
178  void MarkChop() {
179  flags[2] = true;
180  }
181  bool IsChopPt() const {
182  return flags[2] != 0;
183  }
184 
185  TPOINT pos; // position
186  VECTOR vec; // vector to next point
187  // TODO(rays) Remove flags and replace with
188  // is_hidden, runlength, dir, and fixed. The only use
189  // of the flags other than is_hidden is in polyaprx.cpp.
190  char flags[EDGEPTFLAGS]; // concavity, length etc
191  EDGEPT* next; // anticlockwise element
192  EDGEPT* prev; // clockwise element
193  C_OUTLINE* src_outline; // Outline it came from.
194  // The following fields are not used if src_outline is nullptr.
195  int start_step; // Location of pos in src_outline.
196  int step_count; // Number of steps used (may wrap around).
197 };
198 
199 // For use in chop and findseam to keep a list of which EDGEPTs were inserted.
201 
202 struct TESSLINE {
203  TESSLINE() : is_hole(false), loop(nullptr), next(nullptr) {}
204  TESSLINE(const TESSLINE& src) : loop(nullptr), next(nullptr) {
205  CopyFrom(src);
206  }
207  ~TESSLINE() {
208  Clear();
209  }
210  TESSLINE& operator=(const TESSLINE& src) {
211  CopyFrom(src);
212  return *this;
213  }
214  // Consume the circular list of EDGEPTs to make a TESSLINE.
215  static TESSLINE* BuildFromOutlineList(EDGEPT* outline);
216  // Copies the data and the outline, but leaves next untouched.
217  void CopyFrom(const TESSLINE& src);
218  // Deletes owned data.
219  void Clear();
220  // Normalize in-place using the DENORM.
221  void Normalize(const DENORM& denorm);
222  // Rotates by the given rotation in place.
223  void Rotate(const FCOORD rotation);
224  // Moves by the given vec in place.
225  void Move(const ICOORD vec);
226  // Scales by the given factor in place.
227  void Scale(float factor);
228  // Sets up the start and vec members of the loop from the pos members.
229  void SetupFromPos();
230  // Recomputes the bounding box from the points in the loop.
231  void ComputeBoundingBox();
232  // Computes the min and max cross product of the outline points with the
233  // given vec and returns the results in min_xp and max_xp. Geometrically
234  // this is the left and right edge of the outline perpendicular to the
235  // given direction, but to get the distance units correct, you would
236  // have to divide by the modulus of vec.
237  void MinMaxCrossProduct(const TPOINT vec, int* min_xp, int* max_xp) const;
238 
239  TBOX bounding_box() const;
240  // Returns true if *this and other have equal bounding boxes.
241  bool SameBox(const TESSLINE& other) const {
242  return topleft == other.topleft && botright == other.botright;
243  }
244  // Returns true if the given line segment crosses any outline of this blob.
245  bool SegmentCrosses(const TPOINT& pt1, const TPOINT& pt2) const {
246  if (Contains(pt1) && Contains(pt2)) {
247  EDGEPT* pt = loop;
248  do {
249  if (TPOINT::IsCrossed(pt1, pt2, pt->pos, pt->next->pos)) return true;
250  pt = pt->next;
251  } while (pt != loop);
252  }
253  return false;
254  }
255  // Returns true if the point is contained within the outline box.
256  bool Contains(const TPOINT& pt) const {
257  return topleft.x <= pt.x && pt.x <= botright.x &&
258  botright.y <= pt.y && pt.y <= topleft.y;
259  }
260 
261  #ifndef GRAPHICS_DISABLED
262  void plot(ScrollView* window, ScrollView::Color color,
263  ScrollView::Color child_color);
264  #endif // GRAPHICS_DISABLED
265 
266  // Returns the first outline point that has a different src_outline to its
267  // predecessor, or, if all the same, the lowest indexed point.
268  EDGEPT* FindBestStartPt() const;
269 
270 
271  int BBArea() const {
272  return (botright.x - topleft.x) * (topleft.y - botright.y);
273  }
274 
275  TPOINT topleft; // Top left of loop.
276  TPOINT botright; // Bottom right of loop.
277  TPOINT start; // Start of loop.
278  bool is_hole; // True if this is a hole/child outline.
279  EDGEPT *loop; // Edgeloop.
280  TESSLINE *next; // Next outline in blob.
281 }; // Outline structure.
282 
283 struct TBLOB {
284  TBLOB() : outlines(nullptr) {}
285  TBLOB(const TBLOB& src) : outlines(nullptr) {
286  CopyFrom(src);
287  }
288  ~TBLOB() {
289  Clear();
290  }
291  TBLOB& operator=(const TBLOB& src) {
292  CopyFrom(src);
293  return *this;
294  }
295  // Factory to build a TBLOB from a C_BLOB with polygonal approximation along
296  // the way. If allow_detailed_fx is true, the EDGEPTs in the returned TBLOB
297  // contain pointers to the input C_OUTLINEs that enable higher-resolution
298  // feature extraction that does not use the polygonal approximation.
299  static TBLOB* PolygonalCopy(bool allow_detailed_fx, C_BLOB* src);
300  // Factory builds a blob with no outlines, but copies the other member data.
301  static TBLOB* ShallowCopy(const TBLOB& src);
302  // Normalizes the blob for classification only if needed.
303  // (Normally this means a non-zero classify rotation.)
304  // If no Normalization is needed, then nullptr is returned, and the input blob
305  // can be used directly. Otherwise a new TBLOB is returned which must be
306  // deleted after use.
308 
309  // Copies the data and the outlines, but leaves next untouched.
310  void CopyFrom(const TBLOB& src);
311  // Deletes owned data.
312  void Clear();
313  // Sets up the built-in DENORM and normalizes the blob in-place.
314  // For parameters see DENORM::SetupNormalization, plus the inverse flag for
315  // this blob and the Pix for the full image.
316  void Normalize(const BLOCK* block,
317  const FCOORD* rotation,
318  const DENORM* predecessor,
319  float x_origin, float y_origin,
320  float x_scale, float y_scale,
321  float final_xshift, float final_yshift,
322  bool inverse, Pix* pix);
323  // Rotates by the given rotation in place.
324  void Rotate(const FCOORD rotation);
325  // Moves by the given vec in place.
326  void Move(const ICOORD vec);
327  // Scales by the given factor in place.
328  void Scale(float factor);
329  // Recomputes the bounding boxes of the outlines.
330  void ComputeBoundingBoxes();
331 
332  // Returns the number of outlines.
333  int NumOutlines() const;
334 
335  TBOX bounding_box() const;
336 
337  // Returns true if the given line segment crosses any outline of this blob.
338  bool SegmentCrossesOutline(const TPOINT& pt1, const TPOINT& pt2) const {
339  for (const TESSLINE* outline = outlines; outline != nullptr;
340  outline = outline->next) {
341  if (outline->SegmentCrosses(pt1, pt2)) return true;
342  }
343  return false;
344  }
345  // Returns true if the point is contained within any of the outline boxes.
346  bool Contains(const TPOINT& pt) const {
347  for (const TESSLINE* outline = outlines; outline != nullptr;
348  outline = outline->next) {
349  if (outline->Contains(pt)) return true;
350  }
351  return false;
352  }
353 
354  // Finds and deletes any duplicate outlines in this blob, without deleting
355  // their EDGEPTs.
357 
358  // Swaps the outlines of *this and next if needed to keep the centers in
359  // increasing x.
360  void CorrectBlobOrder(TBLOB* next);
361 
362  const DENORM& denorm() const {
363  return denorm_;
364  }
365 
366  #ifndef GRAPHICS_DISABLED
367  void plot(ScrollView* window, ScrollView::Color color,
368  ScrollView::Color child_color);
369  #endif // GRAPHICS_DISABLED
370 
371  int BBArea() const {
372  int total_area = 0;
373  for (TESSLINE* outline = outlines; outline != nullptr; outline = outline->next)
374  total_area += outline->BBArea();
375  return total_area;
376  }
377 
378  // Computes the center of mass and second moments for the old baseline and
379  // 2nd moment normalizations. Returns the outline length.
380  // The input denorm should be the normalizations that have been applied from
381  // the image to the current state of this TBLOB.
382  int ComputeMoments(FCOORD* center, FCOORD* second_moments) const;
383  // Computes the precise bounding box of the coords that are generated by
384  // GetEdgeCoords. This may be different from the bounding box of the polygon.
385  void GetPreciseBoundingBox(TBOX* precise_box) const;
386  // Adds edges to the given vectors.
387  // For all the edge steps in all the outlines, or polygonal approximation
388  // where there are no edge steps, collects the steps into x_coords/y_coords.
389  // x_coords is a collection of the x-coords of vertical edges for each
390  // y-coord starting at box.bottom().
391  // y_coords is a collection of the y-coords of horizontal edges for each
392  // x-coord starting at box.left().
393  // Eg x_coords[0] is a collection of the x-coords of edges at y=bottom.
394  // Eg x_coords[1] is a collection of the x-coords of edges at y=bottom + 1.
395  void GetEdgeCoords(const TBOX& box,
396  GenericVector<GenericVector<int> >* x_coords,
397  GenericVector<GenericVector<int> >* y_coords) const;
398 
399  TESSLINE *outlines; // List of outlines in blob.
400 
401  private: // TODO(rays) Someday the data members will be private too.
402  // For all the edge steps in all the outlines, or polygonal approximation
403  // where there are no edge steps, collects the steps into the bounding_box,
404  // llsq and/or the x_coords/y_coords. Both are used in different kinds of
405  // normalization.
406  // For a description of x_coords, y_coords, see GetEdgeCoords above.
407  void CollectEdges(const TBOX& box,
408  TBOX* bounding_box, LLSQ* llsq,
409  GenericVector<GenericVector<int> >* x_coords,
410  GenericVector<GenericVector<int> >* y_coords) const;
411 
412  private:
413  // DENORM indicating the transformations that this blob has undergone so far.
414  DENORM denorm_;
415 }; // Blob structure.
416 
417 struct TWERD {
418  TWERD() : latin_script(false) {}
419  TWERD(const TWERD& src) {
420  CopyFrom(src);
421  }
422  ~TWERD() {
423  Clear();
424  }
425  TWERD& operator=(const TWERD& src) {
426  CopyFrom(src);
427  return *this;
428  }
429  // Factory to build a TWERD from a (C_BLOB) WERD, with polygonal
430  // approximation along the way.
431  static TWERD* PolygonalCopy(bool allow_detailed_fx, WERD* src);
432  // Baseline normalizes the blobs in-place, recording the normalization in the
433  // DENORMs in the blobs.
434  void BLNormalize(const BLOCK* block, const ROW* row, Pix* pix, bool inverse,
435  float x_height, float baseline_shift, bool numeric_mode,
437  const TBOX* norm_box,
438  DENORM* word_denorm);
439  // Copies the data and the blobs, but leaves next untouched.
440  void CopyFrom(const TWERD& src);
441  // Deletes owned data.
442  void Clear();
443  // Recomputes the bounding boxes of the blobs.
444  void ComputeBoundingBoxes();
445 
446  // Returns the number of blobs in the word.
447  int NumBlobs() const {
448  return blobs.size();
449  }
450  TBOX bounding_box() const;
451 
452  // Merges the blobs from start to end, not including end, and deletes
453  // the blobs between start and end.
454  void MergeBlobs(int start, int end);
455 
456  void plot(ScrollView* window);
457 
458  GenericVector<TBLOB*> blobs; // Blobs in word.
459  bool latin_script; // This word is in a latin-based script.
460 };
461 
462 /*----------------------------------------------------------------------
463  F u n c t i o n s
464 ----------------------------------------------------------------------*/
465 // TODO(rays) Make divisible_blob and divide_blobs members of TBLOB.
466 bool divisible_blob(TBLOB *blob, bool italic_blob, TPOINT* location);
467 
468 void divide_blobs(TBLOB *blob, TBLOB *other_blob, bool italic_blob,
469  const TPOINT& location);
470 
471 #endif
TBLOB::Scale
void Scale(float factor)
Definition: blobs.cpp:437
EDGEPT::SegmentArea
int SegmentArea(const EDGEPT *end) const
Definition: blobs.h:143
TBLOB::ClassifyNormalizeIfNeeded
TBLOB * ClassifyNormalizeIfNeeded() const
Definition: blobs.cpp:345
ScrollView
Definition: scrollview.h:97
TPOINT::TPOINT
TPOINT(const ICOORD &ic)
Definition: blobs.h:52
TWERD::MergeBlobs
void MergeBlobs(int start, int end)
Definition: blobs.cpp:870
TBLOB::ComputeBoundingBoxes
void ComputeBoundingBoxes()
Definition: blobs.cpp:445
normalis.h
TESSLINE::botright
TPOINT botright
Definition: blobs.h:275
TWERD::latin_script
bool latin_script
Definition: blobs.h:458
Normalize
void Normalize(float *Values)
Definition: commontraining.cpp:788
TWERD::operator=
TWERD & operator=(const TWERD &src)
Definition: blobs.h:424
TBLOB::~TBLOB
~TBLOB()
Definition: blobs.h:287
LLSQ
Definition: linlsq.h:27
TPOINT
Definition: blobs.h:49
TBLOB::ShallowCopy
static TBLOB * ShallowCopy(const TBLOB &src)
Definition: blobs.cpp:334
EDGEPT::EqualPos
bool EqualPos(const EDGEPT &other) const
Definition: blobs.h:126
EDGEPT::src_outline
C_OUTLINE * src_outline
Definition: blobs.h:192
TWERD
Definition: blobs.h:416
TBLOB::NumOutlines
int NumOutlines() const
Definition: blobs.cpp:453
TBLOB::Clear
void Clear()
Definition: blobs.cpp:385
EDGEPT::operator=
EDGEPT & operator=(const EDGEPT &src)
Definition: blobs.h:105
TPOINT::TPOINT
TPOINT(int16_t vx, int16_t vy)
Definition: blobs.h:51
TESSLINE::TESSLINE
TESSLINE(const TESSLINE &src)
Definition: blobs.h:203
TBLOB::outlines
TESSLINE * outlines
Definition: blobs.h:398
TBLOB::denorm
const DENORM & denorm() const
Definition: blobs.h:361
EDGEPT::step_count
int step_count
Definition: blobs.h:195
EDGEPT::IsHidden
bool IsHidden() const
Definition: blobs.h:174
EDGEPT::EDGEPT
EDGEPT()
Definition: blobs.h:98
TBLOB::plot
void plot(ScrollView *window, ScrollView::Color color, ScrollView::Color child_color)
Definition: blobs.cpp:508
ICOORD
integer coordinate
Definition: points.h:30
TPOINT::length
int length() const
Definition: blobs.h:87
TESSLINE
Definition: blobs.h:201
TESSLINE::topleft
TPOINT topleft
Definition: blobs.h:274
TBOX::top
int16_t top() const
Definition: rect.h:57
TBOX::set_top
void set_top(int y)
Definition: rect.h:60
TWERD::TWERD
TWERD(const TWERD &src)
Definition: blobs.h:418
TBLOB::ComputeMoments
int ComputeMoments(FCOORD *center, FCOORD *second_moments) const
Definition: blobs.cpp:520
TWERD::Clear
void Clear()
Definition: blobs.cpp:847
rect.h
TESSLINE::next
TESSLINE * next
Definition: blobs.h:279
TBLOB::operator=
TBLOB & operator=(const TBLOB &src)
Definition: blobs.h:290
FCOORD
Definition: points.h:187
TWERD::ComputeBoundingBoxes
void ComputeBoundingBoxes()
Definition: blobs.cpp:853
EDGEPT::MarkChop
void MarkChop()
Definition: blobs.h:177
TBLOB::Contains
bool Contains(const TPOINT &pt) const
Definition: blobs.h:345
divisible_blob
bool divisible_blob(TBLOB *blob, bool italic_blob, TPOINT *location)
Definition: blobs.cpp:910
C_BLOB
Definition: stepblob.h:36
C_OUTLINE
Definition: coutln.h:71
EDGEPTFLAGS
#define EDGEPTFLAGS
Definition: blobs.h:47
EDGEPT::prev
EDGEPT * prev
Definition: blobs.h:191
TWERD::CopyFrom
void CopyFrom(const TWERD &src)
Definition: blobs.cpp:837
TPOINT::dot
int dot(const TPOINT &other) const
Definition: blobs.h:82
EDGEPT::start_step
int start_step
Definition: blobs.h:194
tesseract::OcrEngineMode
OcrEngineMode
Definition: publictypes.h:265
genericvector.h
TBOX::set_right
void set_right(int x)
Definition: rect.h:81
TWERD::TWERD
TWERD()
Definition: blobs.h:417
BLOCK
Definition: ocrblock.h:28
TBLOB::TBLOB
TBLOB()
Definition: blobs.h:283
TPOINT::x
int16_t x
Definition: blobs.h:91
CLISTIZEH
CLISTIZEH(STRING) CLISTIZE(STRING) namespace tesseract
Definition: reject.cpp:50
publictypes.h
TPOINT::y
int16_t y
Definition: blobs.h:92
TWERD::blobs
GenericVector< TBLOB * > blobs
Definition: blobs.h:457
EDGEPT::SegmentBox
TBOX SegmentBox(const EDGEPT *end) const
Definition: blobs.h:129
TPOINT::diff
void diff(const TPOINT &p1, const TPOINT &p2)
Definition: blobs.h:71
TWERD::PolygonalCopy
static TWERD * PolygonalCopy(bool allow_detailed_fx, WERD *src)
Definition: blobs.cpp:774
TBOX::bottom
int16_t bottom() const
Definition: rect.h:64
TBLOB::PolygonalCopy
static TBLOB * PolygonalCopy(bool allow_detailed_fx, C_BLOB *src)
Definition: blobs.cpp:326
TBLOB::Normalize
void Normalize(const BLOCK *block, const FCOORD *rotation, const DENORM *predecessor, float x_origin, float y_origin, float x_scale, float y_scale, float final_xshift, float final_yshift, bool inverse, Pix *pix)
Definition: blobs.cpp:396
TBLOB::GetPreciseBoundingBox
void GetPreciseBoundingBox(TBOX *precise_box) const
Definition: blobs.cpp:539
TWERD::BLNormalize
void BLNormalize(const BLOCK *block, const ROW *row, Pix *pix, bool inverse, float x_height, float baseline_shift, bool numeric_mode, tesseract::OcrEngineMode hint, const TBOX *norm_box, DENORM *word_denorm)
Definition: blobs.cpp:788
TBLOB::TBLOB
TBLOB(const TBLOB &src)
Definition: blobs.h:284
TPOINT::IsCrossed
static bool IsCrossed(const TPOINT &a0, const TPOINT &a1, const TPOINT &b0, const TPOINT &b1)
Definition: blobs.cpp:65
EDGEPT::vec
VECTOR vec
Definition: blobs.h:185
EDGEPT::ShortNonCircularSegment
bool ShortNonCircularSegment(int min_points, const EDGEPT *end) const
Definition: blobs.h:156
TBLOB::bounding_box
TBOX bounding_box() const
Definition: blobs.cpp:466
GenericVector
Definition: baseapi.h:40
EDGEPT::flags
char flags[EDGEPTFLAGS]
Definition: blobs.h:189
TBLOB::EliminateDuplicateOutlines
void EliminateDuplicateOutlines()
Definition: blobs.cpp:478
EDGEPT::WeightedDistance
int WeightedDistance(const EDGEPT &other, int x_factor) const
Definition: blobs.h:120
TPOINT::cross
int cross(const TPOINT &other) const
Definition: blobs.h:77
TWERD::~TWERD
~TWERD()
Definition: blobs.h:421
TPOINT::TPOINT
TPOINT()
Definition: blobs.h:50
TPOINT::operator==
bool operator==(const TPOINT &other) const
Definition: blobs.h:62
TPOINT::operator+=
void operator+=(const TPOINT &other)
Definition: blobs.h:54
TBLOB::CorrectBlobOrder
void CorrectBlobOrder(TBLOB *next)
Definition: blobs.cpp:499
count
int count(LIST var_list)
Definition: oldlist.cpp:79
TBLOB::Rotate
void Rotate(const FCOORD rotation)
Definition: blobs.cpp:421
TBLOB
Definition: blobs.h:282
WERD
Definition: werd.h:55
divide_blobs
void divide_blobs(TBLOB *blob, TBLOB *other_blob, bool italic_blob, const TPOINT &location)
Definition: blobs.cpp:958
TBOX::left
int16_t left() const
Definition: rect.h:71
TPOINT::operator/=
void operator/=(int divisor)
Definition: blobs.h:58
ROW
Definition: ocrrow.h:35
TPOINT
Definition: cleanapi_test.cc:19
TBLOB::GetEdgeCoords
void GetEdgeCoords(const TBOX &box, GenericVector< GenericVector< int > > *x_coords, GenericVector< GenericVector< int > > *y_coords) const
Definition: blobs.cpp:555
TBOX::right
int16_t right() const
Definition: rect.h:78
EDGEPT
Definition: blobs.h:97
TBLOB::CopyFrom
void CopyFrom(const TBLOB &src)
Definition: blobs.cpp:369
EDGEPT::Reveal
void Reveal()
Definition: blobs.h:171
TWERD::plot
void plot(ScrollView *window)
Definition: blobs.cpp:895
EDGEPT::IsChopPt
bool IsChopPt() const
Definition: blobs.h:180
TWERD::bounding_box
TBOX bounding_box() const
Definition: blobs.cpp:859
TBLOB::BBArea
int BBArea() const
Definition: blobs.h:370
TBOX::set_bottom
void set_bottom(int y)
Definition: rect.h:67
ScrollView::Color
Color
Definition: scrollview.h:100
EDGEPT::Hide
void Hide()
Definition: blobs.h:168
GenericVector::size
int size() const
Definition: genericvector.h:71
TBLOB::Move
void Move(const ICOORD vec)
Definition: blobs.cpp:429
scrollview.h
EDGEPT::pos
TPOINT pos
Definition: blobs.h:184
TWERD::NumBlobs
int NumBlobs() const
Definition: blobs.h:446
EDGEPT::next
EDGEPT * next
Definition: blobs.h:190
TBOX::set_left
void set_left(int x)
Definition: rect.h:74
clst.h
EDGEPT::CopyFrom
void CopyFrom(const EDGEPT &src)
Definition: blobs.h:110
points.h
TBOX
Definition: rect.h:33
TBLOB::SegmentCrossesOutline
bool SegmentCrossesOutline(const TPOINT &pt1, const TPOINT &pt2) const
Definition: blobs.h:337
DENORM
Definition: normalis.h:49