mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 11:09:06 +08:00
Squash some warnings in MSVC build.
In particular, "defined but not used" (caused by GRAPHICS_DISABLED), double constants being truncated to floats, and implicit casts.
This commit is contained in:
parent
7fa200bfb7
commit
150e2e54fe
@ -74,9 +74,6 @@ void Tesseract::recog_pseudo_word(PAGE_RES* page_res,
|
||||
* @param pr_it the page results iterator
|
||||
*/
|
||||
bool Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
|
||||
int16_t char_qual;
|
||||
int16_t good_char_qual;
|
||||
|
||||
WordData word_data(*pr_it);
|
||||
SetupWordPassN(2, &word_data);
|
||||
// LSTM doesn't run on pass2, but we want to run pass2 for tesseract.
|
||||
@ -89,6 +86,8 @@ bool Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
|
||||
}
|
||||
#ifndef DISABLED_LEGACY_ENGINE
|
||||
if (tessedit_debug_quality_metrics) {
|
||||
int16_t char_qual;
|
||||
int16_t good_char_qual;
|
||||
WERD_RES* word_res = pr_it->word();
|
||||
word_char_quality(word_res, &char_qual, &good_char_qual);
|
||||
tprintf("\n%d chars; word_blob_quality: %d; outline_errs: %d; "
|
||||
|
@ -71,7 +71,7 @@ class ICOORD
|
||||
|
||||
///find sq length
|
||||
float sqlength() const {
|
||||
return xcoord * xcoord + ycoord * ycoord;
|
||||
return (float)(xcoord * xcoord + ycoord * ycoord);
|
||||
}
|
||||
|
||||
///find length
|
||||
@ -95,7 +95,7 @@ class ICOORD
|
||||
|
||||
///find angle
|
||||
float angle() const {
|
||||
return std::atan2(ycoord, xcoord);
|
||||
return (float)std::atan2(ycoord, xcoord);
|
||||
}
|
||||
|
||||
///test equality
|
||||
|
@ -456,7 +456,7 @@ void WERD_CHOICE::string_and_lengths(STRING *word_str,
|
||||
const char *ch = unicharset_->id_to_unichar_ext(unichar_ids_[i]);
|
||||
*word_str += ch;
|
||||
if (word_lengths_str != nullptr) {
|
||||
*word_lengths_str += strlen(ch);
|
||||
*word_lengths_str += (char)strlen(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,11 +32,11 @@ static BOOL_VAR(textord_space_size_is_variable, false,
|
||||
namespace {
|
||||
|
||||
// Allow +/-10% error for character pitch / body size.
|
||||
static const float kFPTolerance = 0.1;
|
||||
static const float kFPTolerance = 0.1f;
|
||||
|
||||
// Minimum ratio of "good" character pitch for a row to be considered
|
||||
// to be fixed-pitch.
|
||||
static const float kFixedPitchThreshold = 0.35;
|
||||
static const float kFixedPitchThreshold = 0.35f;
|
||||
|
||||
// rank statistics for a small collection of float values.
|
||||
class SimpleStats {
|
||||
@ -1020,7 +1020,7 @@ void FPAnalyzer::EstimatePitch(bool pass1) {
|
||||
} else if (row.num_chars() > 1) {
|
||||
float estimated_pitch =
|
||||
pitch_height_stats.EstimateYFor(row.height() + row.gap(),
|
||||
0.1);
|
||||
0.1f);
|
||||
// CJK characters are more likely to be fragmented than poorly
|
||||
// chopped. So trust the page-level estimation of character
|
||||
// pitch only if it's larger than row-level estimation or
|
||||
|
@ -583,7 +583,7 @@ float jumplimit /*guess half descenders */
|
||||
}
|
||||
}
|
||||
|
||||
jumplimit *= 1.2;
|
||||
jumplimit *= 1.2f;
|
||||
/*must be wavy */
|
||||
if (maxmax - minmin > jumplimit) {
|
||||
ycount = segment; /*no of segments */
|
||||
|
@ -417,10 +417,8 @@ bool try_doc_fixed( //determine pitch
|
||||
int16_t projection_right;
|
||||
int16_t row_left; //edges of row
|
||||
int16_t row_right;
|
||||
ICOORDELT_LIST *master_cells; //cells for page
|
||||
float master_y; //uniform shifts
|
||||
float shift_factor; //page skew correction
|
||||
float row_shift; //shift for row
|
||||
float final_pitch; //output pitch
|
||||
float row_y; //baseline
|
||||
STATS projection; //entire page
|
||||
@ -512,13 +510,15 @@ bool try_doc_fixed( //determine pitch
|
||||
|
||||
#ifndef GRAPHICS_DISABLED
|
||||
if (textord_show_page_cuts && to_win != nullptr) {
|
||||
float row_shift; //shift for row
|
||||
ICOORDELT_LIST *master_cells; //cells for page
|
||||
master_cells = &row->char_cells;
|
||||
for (block_it.mark_cycle_pt (); !block_it.cycled_list ();
|
||||
block_it.forward ()) {
|
||||
block = block_it.data ();
|
||||
row_it.set_to_list (block->get_rows ());
|
||||
for (row_it.mark_cycle_pt (); !row_it.cycled_list ();
|
||||
row_it.forward ()) {
|
||||
row_it.forward ()) {
|
||||
row = row_it.data ();
|
||||
row_y = row->baseline.y (master_x);
|
||||
row_shift = shift_factor * (master_y - row_y);
|
||||
@ -871,7 +871,7 @@ bool find_row_pitch( //find lines
|
||||
|
||||
if (!count_pitch_stats (row, &gap_stats, &pitch_stats,
|
||||
initial_pitch, min_space, true, false, dm_gap)) {
|
||||
dm_gap_iqr = 0.0001;
|
||||
dm_gap_iqr = 0.0001f;
|
||||
dm_pitch_iqr = maxwidth * 2.0f;
|
||||
dm_pitch = initial_pitch;
|
||||
}
|
||||
@ -884,7 +884,7 @@ bool find_row_pitch( //find lines
|
||||
pitch_stats.clear ();
|
||||
if (!count_pitch_stats (row, &gap_stats, &pitch_stats,
|
||||
initial_pitch, min_space, true, false, 0)) {
|
||||
gap_iqr = 0.0001;
|
||||
gap_iqr = 0.0001f;
|
||||
pitch_iqr = maxwidth * 3.0f;
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user