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
search_object.h
Go to the documentation of this file.
1 /**********************************************************************
2 * File: search_object.h
3 * Description: Declaration of the Beam Search Object Class
4 * Author: Ahmad Abdulkader
5 * Created: 2008
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 SearchObject class represents a char_samp (a word bitmap) that is
21 // being searched for characters (or recognizeable entities).
22 // This is an abstract class that all SearchObjects should inherit from
23 // A SearchObject class provides methods to:
24 // 1- Returns the count of segments
25 // 2- Recognize a segment range
26 // 3- Creates a CharSamp for a segment range
27
28 #ifndef SEARCH_OBJECT_H
29 #define SEARCH_OBJECT_H
30
31 #include "char_altlist.h"
32 #include "char_samp.h"
33 #include "cube_reco_context.h"
34
35 namespace tesseract {
36 class SearchObject {
37 public:
38 explicit SearchObject(CubeRecoContext *cntxt) { cntxt_ = cntxt; }
39 virtual ~SearchObject() {}
40
41 virtual int SegPtCnt() = 0;
42 virtual CharAltList *RecognizeSegment(int start_pt, int end_pt) = 0;
43 virtual CharSamp *CharSample(int start_pt, int end_pt) = 0;
44 virtual Box* CharBox(int start_pt, int end_pt) = 0;
45
46 virtual int SpaceCost(int seg_pt) = 0;
47 virtual int NoSpaceCost(int seg_pt) = 0;
48 virtual int NoSpaceCost(int start_pt, int end_pt) = 0;
49
50 protected:
51 CubeRecoContext *cntxt_;
52 };
53 }
54
55 #endif // SEARCH_OBJECT_H