tesseract v5.3.3.20231005
mutableiterator.h
Go to the documentation of this file.
1
2// 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//
7// (C) Copyright 2011, 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//
19
20#ifndef TESSERACT_CCMAIN_MUTABLEITERATOR_H_
21#define TESSERACT_CCMAIN_MUTABLEITERATOR_H_
22
24
25class BLOB_CHOICE_IT;
26
27namespace tesseract {
28
29class Tesseract;
30
31// Class to iterate over tesseract results, providing access to all levels
32// of the page hierarchy, without including any tesseract headers or having
33// to handle any tesseract structures.
34// WARNING! This class points to data held within the TessBaseAPI class, and
35// therefore can only be used while the TessBaseAPI class still exists and
36// has not been subjected to a call of Init, SetImage, Recognize, Clear, End
37// DetectOS, or anything else that changes the internal PAGE_RES.
38// See tesseract/publictypes.h for the definition of PageIteratorLevel.
39// See also base class PageIterator, which contains the bulk of the interface.
40// ResultIterator adds text-specific methods for access to OCR output.
41// MutableIterator adds access to internal data structures.
42
44public:
45 // See argument descriptions in ResultIterator()
46 MutableIterator(PAGE_RES *page_res, Tesseract *tesseract, int scale, int scaled_yres,
47 int rect_left, int rect_top, int rect_width, int rect_height)
48 : ResultIterator(LTRResultIterator(page_res, tesseract, scale, scaled_yres, rect_left,
49 rect_top, rect_width, rect_height)) {}
50 ~MutableIterator() override;
51
52 // See PageIterator and ResultIterator for most calls.
53
54 // Return access to Tesseract internals.
55 const PAGE_RES_IT *PageResIt() const {
56 return it_;
57 }
58};
59
60} // namespace tesseract.
61
62#endif // TESSERACT_CCMAIN_MUTABLEITERATOR_H_
const PAGE_RES_IT * PageResIt() const
MutableIterator(PAGE_RES *page_res, Tesseract *tesseract, int scale, int scaled_yres, int rect_left, int rect_top, int rect_width, int rect_height)
#define TESS_API
Definition: export.h:32