Definition at line 111 of file cjkpitch.cpp.
◆ LocalCorrelation()
tesseract::LocalCorrelation::LocalCorrelation |
( |
| ) |
|
|
inline |
◆ ~LocalCorrelation()
tesseract::LocalCorrelation::~LocalCorrelation |
( |
| ) |
|
|
default |
◆ Add()
void tesseract::LocalCorrelation::Add |
( |
float |
x, |
|
|
float |
y, |
|
|
int |
v |
|
) |
| |
|
inline |
Definition at line 130 of file cjkpitch.cpp.
130 {
131 struct float_pair
value;
135 values_.push_back(
value);
136 finalized_ = false;
137 }
◆ Clear()
void tesseract::LocalCorrelation::Clear |
( |
| ) |
|
|
inline |
Definition at line 126 of file cjkpitch.cpp.
126 {
127 finalized_ = false;
128 }
◆ EstimateYFor()
float tesseract::LocalCorrelation::EstimateYFor |
( |
float |
x, |
|
|
float |
r |
|
) |
| |
|
inline |
Definition at line 139 of file cjkpitch.cpp.
139 {
141 unsigned start = 0, end = values_.size();
142
143
144 while (start < values_.size() && values_[start].x <
x * (1 - r)) {
145 start++;
146 }
147 while (end > 0 && values_[end - 1].
x >
x * (1 + r)) {
148 end--;
149 }
150
151
152
153 if (start >= end) {
154 start = 0;
155 end = values_.size();
156 }
157
158
159 float rc = 0;
160 int vote = 0;
161 for (
auto i = start;
i < end;
i++) {
162 rc += values_[
i].vote *
x * values_[
i].y / values_[
i].x;
163 vote += values_[
i].vote;
164 }
165
166 return vote == 0 ? 0.0f : rc / vote;
167 }
◆ Finish()
void tesseract::LocalCorrelation::Finish |
( |
| ) |
|
|
inline |
Definition at line 121 of file cjkpitch.cpp.
121 {
122 std::sort(values_.begin(), values_.end(), float_pair_compare);
123 finalized_ = true;
124 }
The documentation for this class was generated from the following file:
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/textord/cjkpitch.cpp