tesseract  v4.0.0-17-g361f3264
Open Source OCR Engine
mutableiterator.h
1 // File: mutableiterator.h
3 // Description: Iterator for tesseract results providing access to
4 // both high-level API and Tesseract internal data structures.
5 // Author: David Eger
6 // Created: Thu Feb 24 19:01:06 PST 2011
7 //
8 // (C) Copyright 2011, Google Inc.
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
20 
21 #ifndef TESSERACT_CCMAIN_MUTABLEITERATOR_H_
22 #define TESSERACT_CCMAIN_MUTABLEITERATOR_H_
23 
24 #include "resultiterator.h"
25 
26 class BLOB_CHOICE_IT;
27 
28 namespace tesseract {
29 
30 class Tesseract;
31 
32 // Class to iterate over tesseract results, providing access to all levels
33 // of the page hierarchy, without including any tesseract headers or having
34 // to handle any tesseract structures.
35 // WARNING! This class points to data held within the TessBaseAPI class, and
36 // therefore can only be used while the TessBaseAPI class still exists and
37 // has not been subjected to a call of Init, SetImage, Recognize, Clear, End
38 // DetectOS, or anything else that changes the internal PAGE_RES.
39 // See apitypes.h for the definition of PageIteratorLevel.
40 // See also base class PageIterator, which contains the bulk of the interface.
41 // ResultIterator adds text-specific methods for access to OCR output.
42 // MutableIterator adds access to internal data structures.
43 
45  public:
46  // See argument descriptions in ResultIterator()
48  int scale, int scaled_yres,
49  int rect_left, int rect_top,
50  int rect_width, int rect_height)
52  LTRResultIterator(page_res, tesseract, scale, scaled_yres, rect_left,
53  rect_top, rect_width, rect_height)) {}
54  virtual ~MutableIterator();
55 
56  // See PageIterator and ResultIterator for most calls.
57 
58  // Return access to Tesseract internals.
59  const PAGE_RES_IT *PageResIt() const { return it_; }
60 };
61 
62 } // namespace tesseract.
63 
64 #endif // TESSERACT_CCMAIN_MUTABLEITERATOR_H_
MutableIterator(PAGE_RES *page_res, Tesseract *tesseract, int scale, int scaled_yres, int rect_left, int rect_top, int rect_width, int rect_height)
Definition: mutableiterator.h:47
Definition: resultiterator.h:41
Definition: baseapi.cpp:94
Definition: pageres.h:675
Definition: ltrresultiterator.h:48
const PAGE_RES_IT * PageResIt() const
Definition: mutableiterator.h:59
Definition: mutableiterator.h:44
Definition: tesseractclass.h:173
PAGE_RES_IT * it_
Definition: pageiterator.h:334
Definition: pageres.h:77