#include <intfeaturemap.h>
Definition at line 48 of file intfeaturemap.h.
◆ IntFeatureMap()
tesseract::IntFeatureMap::IntFeatureMap |
( |
| ) |
|
Definition at line 33 of file intfeaturemap.cpp.
33 : mapping_changed_(true), compact_size_(0) {
34 for (int dir = 0; dir < kNumOffsetMaps; ++dir) {
35 offset_plus_[dir] = nullptr;
36 offset_minus_[dir] = nullptr;
37 }
38}
◆ ~IntFeatureMap()
tesseract::IntFeatureMap::~IntFeatureMap |
( |
| ) |
|
◆ compact_size()
int tesseract::IntFeatureMap::compact_size |
( |
| ) |
const |
|
inline |
◆ DebugMapFeatures()
void tesseract::IntFeatureMap::DebugMapFeatures |
( |
const std::vector< int > & |
map_features | ) |
const |
Definition at line 168 of file intfeaturemap.cpp.
168 {
169 for (int map_feature : map_features) {
171 f.print();
172 }
173}
INT_FEATURE_STRUCT InverseMapFeature(int map_feature) const
◆ DeleteMapFeature()
void tesseract::IntFeatureMap::DeleteMapFeature |
( |
int |
map_feature | ) |
|
Definition at line 61 of file intfeaturemap.cpp.
61 {
62 feature_map_.
Merge(-1, map_feature);
63 mapping_changed_ = true;
64}
bool Merge(int compact_index1, int compact_index2)
◆ feature_map()
const IndexMapBiDi & tesseract::IntFeatureMap::feature_map |
( |
| ) |
const |
|
inline |
◆ feature_space()
◆ FinalizeMapping()
Definition at line 155 of file intfeaturemap.cpp.
155 {
156 if (mapping_changed_) {
159#ifdef EXPERIMENT_ON
160 it->MapSampleFeatures(*this);
161#endif
162 mapping_changed_ = false;
163 }
164 return compact_size_;
165}
◆ FindNZFeatureMapping()
int tesseract::IntFeatureMap::FindNZFeatureMapping |
( |
SampleIterator * |
it | ) |
|
◆ IndexAndSortFeatures()
void tesseract::IntFeatureMap::IndexAndSortFeatures |
( |
const INT_FEATURE_STRUCT * |
features, |
|
|
int |
num_features, |
|
|
std::vector< int > * |
sorted_features |
|
) |
| const |
|
inline |
Definition at line 104 of file intfeaturemap.h.
105 {
107 }
void IndexAndSortFeatures(const INT_FEATURE_STRUCT *features, int num_features, std::vector< int > *sorted_features) const
◆ IndexFeature()
Definition at line 45 of file intfeaturemap.cpp.
45 {
46 return feature_space_.
Index(f);
47}
int Index(const INT_FEATURE_STRUCT &f) const
◆ Init()
void tesseract::IntFeatureMap::Init |
( |
const IntFeatureSpace & |
feature_space | ) |
|
Definition at line 71 of file intfeaturemap.cpp.
71 {
73 mapping_changed_ = false;
78
80 if (dir.x() == 0.0f && dir.y() == 0.0f) {
82 }
83
84 for (int dir = 0; dir < kNumOffsetMaps; ++dir) {
85 delete[] offset_plus_[dir];
86 delete[] offset_minus_[dir];
89 }
90 for (int dir = 1; dir <= kNumOffsetMaps; ++dir) {
92 int offset_index = ComputeOffsetFeature(
i, dir);
93 offset_plus_[dir - 1][
i] = offset_index;
94 offset_index = ComputeOffsetFeature(
i, -dir);
95 offset_minus_[dir - 1][
i] = offset_index;
96 }
97 }
98}
FCOORD FeatureDirection(uint8_t theta)
void Init(int size, bool all_mapped)
const IntFeatureSpace & feature_space() const
◆ InverseIndexFeature()
INT_FEATURE_STRUCT tesseract::IntFeatureMap::InverseIndexFeature |
( |
int |
index_feature | ) |
const |
Definition at line 54 of file intfeaturemap.cpp.
54 {
56}
INT_FEATURE_STRUCT PositionFromIndex(int index) const
◆ InverseMapFeature()
Definition at line 57 of file intfeaturemap.cpp.
57 {
60}
int CompactToSparse(int compact_index) const
◆ IsMapFeatureDeleted()
bool tesseract::IntFeatureMap::IsMapFeatureDeleted |
( |
int |
map_feature | ) |
const |
Definition at line 65 of file intfeaturemap.cpp.
65 {
67}
bool IsCompactDeleted(int index) const
◆ MapFeature()
Definition at line 48 of file intfeaturemap.cpp.
48 {
50}
int SparseToCompact(int sparse_index) const override
◆ MapIndexedFeatures()
int tesseract::IntFeatureMap::MapIndexedFeatures |
( |
const std::vector< int > & |
index_features, |
|
|
std::vector< int > * |
map_features |
|
) |
| const |
|
inline |
Definition at line 113 of file intfeaturemap.h.
114 {
115 return feature_map_.
MapFeatures(index_features, map_features);
116 }
int MapFeatures(const std::vector< int > &sparse, std::vector< int > *compact) const
◆ MapIndexFeature()
int tesseract::IntFeatureMap::MapIndexFeature |
( |
int |
index_feature | ) |
const |
◆ OffsetFeature()
int tesseract::IntFeatureMap::OffsetFeature |
( |
int |
index_feature, |
|
|
int |
dir |
|
) |
| const |
Definition at line 112 of file intfeaturemap.cpp.
112 {
113 if (dir > 0 && dir <= kNumOffsetMaps) {
114 return offset_plus_[dir - 1][index_feature];
115 } else if (dir < 0 && -dir <= kNumOffsetMaps) {
116 return offset_minus_[-dir - 1][index_feature];
117 } else if (dir == 0) {
118 return index_feature;
119 } else {
120 return -1;
121 }
122}
◆ sparse_size()
int tesseract::IntFeatureMap::sparse_size |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files:
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/training/common/intfeaturemap.h
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/training/common/intfeaturemap.cpp