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
matchtab.h
Go to the documentation of this file.
1 /* -*-C-*-
2 ********************************************************************************
3 *
4 * File: matchtab.h (Formerly matchtab.h)
5 * Description: Match table to retain blobs that were matched.
6 * Author: Mark Seaman, OCR Technology
7 * Created: Mon Jan 29 09:00:56 1990
8 * Modified: Tue Mar 19 15:38:19 1991 (Mark Seaman) marks@hpgrlt
9 * Language: C
10 * Package: N/A
11 * Status: Experimental (Do Not Distribute)
12 *
13 * (c) Copyright 1990, Hewlett-Packard Company.
14 ** Licensed under the Apache License, Version 2.0 (the "License");
15 ** you may not use this file except in compliance with the License.
16 ** You may obtain a copy of the License at
17 ** http://www.apache.org/licenses/LICENSE-2.0
18 ** Unless required by applicable law or agreed to in writing, software
19 ** distributed under the License is distributed on an "AS IS" BASIS,
20 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 ** See the License for the specific language governing permissions and
22 ** limitations under the License.
23 *
24 *********************************************************************************/
25 #ifndef MATCHTAB_H
26 #define MATCHTAB_H
27
28 #include "ratngs.h"
29 #include "blobs.h"
30
31 namespace tesseract {
32
33 struct MATCH {
34 MATCH() : rating(NULL) {}
35 TBOX box;
36 BLOB_CHOICE_LIST *rating;
37 };
38
39 // A class for mapping rectangular bounding boxes to choice lists.
40 // Only meant to be used at the word level, as we have a limit of
41 // 500 recognition lists for all subsequences of blobs.
42 class BlobMatchTable {
43 public:
44 BlobMatchTable();
45 ~BlobMatchTable();
46
47 void init_match_table();
48 void end_match_table();
49 void put_match(TBLOB *blob, BLOB_CHOICE_LIST *ratings);
50 BLOB_CHOICE_LIST *get_match(TBLOB *blob);
51 BLOB_CHOICE_LIST *get_match_by_box(const TBOX &box);
52 void add_to_match(TBLOB *blob, BLOB_CHOICE_LIST *ratings);
53
54 private:
55 int Hash(const TBOX &box) const;
56 // Returns whether the idx entry in the array is still empty.
57 bool IsEmpty(int idx) const;
58
59 bool been_initialized_;
60 MATCH* match_table_;
61 };
62
63 }
64 #endif