forked from gali8/Tesseract-OCR-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcube_line_object.h
67 lines (60 loc) · 2.07 KB
/
cube_line_object.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**********************************************************************
* File: cube_line_object.h
* Description: Declaration of the Cube Line Object Class
* Author: Ahmad Abdulkader
* Created: 2007
*
* (C) Copyright 2008, Google Inc.
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
** http://www.apache.org/licenses/LICENSE-2.0
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*
**********************************************************************/
// The CubeLineObject implements an objects that holds a line of text
// Each line is broken into phrases. Phrases are blocks within the line that
// are unambiguously separate collections of words
#ifndef CUBE_LINE_OBJECT_H
#define CUBE_LINE_OBJECT_H
#include "cube_reco_context.h"
#include "cube_object.h"
#include "allheaders.h"
namespace tesseract {
class CubeLineObject {
public:
CubeLineObject(CubeRecoContext *cntxt, Pix *pix);
~CubeLineObject();
// accessors
inline int PhraseCount() {
if (!processed_ && !Process()) {
return 0;
}
return phrase_cnt_;
}
inline CubeObject **Phrases() {
if (!processed_ && !Process()) {
return NULL;
}
return phrases_;
}
private:
CubeRecoContext *cntxt_;
bool own_pix_;
bool processed_;
Pix *line_pix_;
CubeObject **phrases_;
int phrase_cnt_;
bool Process();
// Compute the least word breaking threshold that is required to produce a
// valid set of phrases. Phrases are validated using the Aspect ratio
// constraints specified in the language specific Params object
int ComputeWordBreakThreshold(int con_comp_cnt, ConComp **con_comps,
bool rtl);
};
}
#endif // CUBE_LINE_OBJECT_H