Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cube_line_object.h
Go to the documentation of this file.
1 /**********************************************************************
2 * File: cube_line_object.h
3 * Description: Declaration of the Cube Line Object Class
4 * Author: Ahmad Abdulkader
5 * Created: 2007
6 *
7 * (C) Copyright 2008, Google Inc.
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 // The CubeLineObject implements an objects that holds a line of text
21 // Each line is broken into phrases. Phrases are blocks within the line that
22 // are unambiguously separate collections of words
23
24 #ifndef CUBE_LINE_OBJECT_H
25 #define CUBE_LINE_OBJECT_H
26
27 #include "cube_reco_context.h"
28 #include "cube_object.h"
29 #include "allheaders.h"
30
31 namespace tesseract {
32 class CubeLineObject {
33 public:
34 CubeLineObject(CubeRecoContext *cntxt, Pix *pix);
35 ~CubeLineObject();
36
37 // accessors
38 inline int PhraseCount() {
39 if (!processed_ && !Process()) {
40 return 0;
41 }
42 return phrase_cnt_;
43 }
44 inline CubeObject **Phrases() {
45 if (!processed_ && !Process()) {
46 return NULL;
47 }
48 return phrases_;
49 }
50
51 private:
52 CubeRecoContext *cntxt_;
53 bool own_pix_;
54 bool processed_;
55 Pix *line_pix_;
56 CubeObject **phrases_;
57 int phrase_cnt_;
58 bool Process();
59 // Compute the least word breaking threshold that is required to produce a
60 // valid set of phrases. Phrases are validated using the Aspect ratio
61 // constraints specified in the language specific Params object
62 int ComputeWordBreakThreshold(int con_comp_cnt, ConComp **con_comps,
63 bool rtl);
64 };
65 }
66
67 #endif // CUBE_LINE_OBJECT_H