More std::vector.

This commit is contained in:
Egor Pugin 2021-01-07 15:13:59 +03:00
parent 8d6cad1acc
commit 8cb1c62259
3 changed files with 6 additions and 7 deletions

View File

@ -168,8 +168,8 @@ ErrorCounter::ErrorCounter(const UNICHARSET& unicharset, int fontsize)
ok_score_hist_(0, 101), bad_score_hist_(0, 101),
unicharset_(unicharset) {
Counts empty_counts;
font_counts_.init_to_size(fontsize, empty_counts);
multi_unichar_counts_.init_to_size(unicharset.size(), 0);
font_counts_.resize(fontsize, empty_counts);
multi_unichar_counts_.resize(unicharset.size(), 0);
}
// Accumulates the errors from the classifier results on a single sample.

View File

@ -16,11 +16,10 @@
#ifndef THIRD_PARTY_TESSERACT_CLASSIFY_ERRORCOUNTER_H_
#define THIRD_PARTY_TESSERACT_CLASSIFY_ERRORCOUNTER_H_
#include "genericvector.h"
#include "matrix.h"
#include "statistc.h"
#include "genericvector.h"
struct Pix;
namespace tesseract {
@ -209,13 +208,13 @@ class ErrorCounter {
// Difference in result rating to be thought of as an "equal" choice.
double rating_epsilon_;
// Vector indexed by font_id from the samples of error accumulators.
GenericVector<Counts> font_counts_;
std::vector<Counts> font_counts_;
// Counts of the results that map each unichar_id (from samples) to an
// incorrect shape_id.
GENERIC_2D_ARRAY<int> unichar_counts_;
// Count of the number of times each shape_id occurs, is correct, and multi-
// unichar.
GenericVector<int> multi_unichar_counts_;
std::vector<int> multi_unichar_counts_;
// Histogram of scores (as percent) for correct answers.
STATS ok_score_hist_;
// Histogram of scores (as percent) for incorrect answers.

View File

@ -367,7 +367,7 @@ bool MasterTrainer::LoadFontInfo(const char* filename) {
// Returns false on failure.
bool MasterTrainer::LoadXHeights(const char* filename) {
tprintf("fontinfo table is of size %d\n", fontinfo_table_.size());
xheights_.init_to_size(fontinfo_table_.size(), -1);
xheights_.resize(fontinfo_table_.size(), -1);
if (filename == nullptr) return true;
FILE *f = fopen(filename, "rb");
if (f == nullptr) {