#include <shapetable.h>
Definition at line 185 of file shapetable.h.
◆ Shape()
tesseract::Shape::Shape |
( |
| ) |
|
|
inline |
Definition at line 187 of file shapetable.h.
187 : destination_index_(-1) {}
◆ AddShape()
void tesseract::Shape::AddShape |
( |
const Shape & |
other | ) |
|
Definition at line 125 of file shapetable.cpp.
126 for (
int c = 0; c < other.unichars_.size(); ++c) {
127 for (
int f = 0; f < other.unichars_[c].font_ids.size(); ++f) {
129 other.unichars_[c].font_ids[f]);
132 unichars_sorted_ = unichars_.size() <= 1;
void AddToShape(int unichar_id, int font_id)
◆ AddToShape()
void tesseract::Shape::AddToShape |
( |
int |
unichar_id, |
|
|
int |
font_id |
|
) |
| |
Definition at line 106 of file shapetable.cpp.
107 for (
int c = 0; c < unichars_.size(); ++c) {
108 if (unichars_[c].unichar_id == unichar_id) {
111 for (
int f = 0; f < font_list.
size(); ++f) {
112 if (font_list[f] == font_id)
120 unichars_.push_back(UnicharAndFonts(unichar_id, font_id));
121 unichars_sorted_ = unichars_.size() <= 1;
◆ ContainsFont()
bool tesseract::Shape::ContainsFont |
( |
int |
font_id | ) |
const |
Definition at line 162 of file shapetable.cpp.
163 for (
int c = 0; c < unichars_.size(); ++c) {
165 for (
int f = 0; f < font_list.
size(); ++f) {
166 if (font_list[f] == font_id)
◆ ContainsFontProperties()
bool tesseract::Shape::ContainsFontProperties |
( |
const FontInfoTable & |
font_table, |
|
|
uinT32 |
properties |
|
) |
| const |
Definition at line 174 of file shapetable.cpp.
176 for (
int c = 0; c < unichars_.size(); ++c) {
178 for (
int f = 0; f < font_list.
size(); ++f) {
179 if (font_table.get(font_list[f]).properties == properties)
◆ ContainsMultipleFontProperties()
bool tesseract::Shape::ContainsMultipleFontProperties |
( |
const FontInfoTable & |
font_table | ) |
const |
Definition at line 187 of file shapetable.cpp.
189 uinT32 properties = font_table.get(unichars_[0].font_ids[0]).properties;
190 for (
int c = 0; c < unichars_.size(); ++c) {
192 for (
int f = 0; f < font_list.
size(); ++f) {
193 if (font_table.get(font_list[f]).properties != properties)
◆ ContainsUnichar()
bool tesseract::Shape::ContainsUnichar |
( |
int |
unichar_id | ) |
const |
Definition at line 152 of file shapetable.cpp.
153 for (
int c = 0; c < unichars_.size(); ++c) {
154 if (unichars_[c].unichar_id == unichar_id) {
◆ ContainsUnicharAndFont()
bool tesseract::Shape::ContainsUnicharAndFont |
( |
int |
unichar_id, |
|
|
int |
font_id |
|
) |
| const |
Definition at line 136 of file shapetable.cpp.
137 for (
int c = 0; c < unichars_.size(); ++c) {
138 if (unichars_[c].unichar_id == unichar_id) {
141 for (
int f = 0; f < font_list.
size(); ++f) {
142 if (font_list[f] == font_id)
◆ DeSerialize()
bool tesseract::Shape::DeSerialize |
( |
TFile * |
fp | ) |
|
Definition at line 97 of file shapetable.cpp.
99 if (fp->FRead(&sorted,
sizeof(sorted), 1) != 1)
return false;
100 unichars_sorted_ = sorted != 0;
101 return unichars_.DeSerializeClasses(fp);
◆ destination_index()
int tesseract::Shape::destination_index |
( |
| ) |
const |
|
inline |
Definition at line 194 of file shapetable.h.
195 return destination_index_;
◆ IsEqualUnichars()
bool tesseract::Shape::IsEqualUnichars |
( |
Shape * |
other | ) |
|
Definition at line 222 of file shapetable.cpp.
223 if (unichars_.size() != other->unichars_.size())
return false;
224 if (!unichars_sorted_) SortUnichars();
225 if (!other->unichars_sorted_) other->SortUnichars();
226 for (
int c = 0; c < unichars_.size(); ++c) {
227 if (unichars_[c].unichar_id != other->unichars_[c].unichar_id)
◆ IsSubsetOf()
bool tesseract::Shape::IsSubsetOf |
( |
const Shape & |
other | ) |
const |
Definition at line 207 of file shapetable.cpp.
208 for (
int c = 0; c < unichars_.size(); ++c) {
209 int unichar_id = unichars_[c].unichar_id;
211 for (
int f = 0; f < font_list.
size(); ++f) {
212 if (!other.ContainsUnicharAndFont(unichar_id, font_list[f]))
◆ operator==()
bool tesseract::Shape::operator== |
( |
const Shape & |
other | ) |
const |
Definition at line 202 of file shapetable.cpp.
203 return IsSubsetOf(other) && other.IsSubsetOf(*
this);
bool IsSubsetOf(const Shape &other) const
◆ operator[]()
◆ Serialize()
bool tesseract::Shape::Serialize |
( |
FILE * |
fp | ) |
const |
Definition at line 88 of file shapetable.cpp.
89 uinT8 sorted = unichars_sorted_;
90 if (fwrite(&sorted,
sizeof(sorted), 1, fp) != 1)
92 if (!unichars_.SerializeClasses(fp))
return false;
◆ set_destination_index()
void tesseract::Shape::set_destination_index |
( |
int |
index | ) |
|
|
inline |
Definition at line 197 of file shapetable.h.
198 destination_index_ = index;
◆ SetUnicharId()
void tesseract::Shape::SetUnicharId |
( |
int |
index, |
|
|
int |
unichar_id |
|
) |
| |
|
inline |
Definition at line 209 of file shapetable.h.
210 unichars_[index].unichar_id = unichar_id;
◆ size()
int tesseract::Shape::size |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files:
- /home/stefan/src/github/tesseract-ocr/tesseract/classify/shapetable.h
- /home/stefan/src/github/tesseract-ocr/tesseract/classify/shapetable.cpp