Refactor function Textord::clean_noise_from_row (#4225)

Co-authored-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Sadra Barikbin 2024-04-26 09:23:31 +03:30 committed by GitHub
parent a1837f18e0
commit d461867812
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -533,16 +533,17 @@ bool Textord::clean_noise_from_row( // remove empties
}
}
}
// TODO: check whether `&& super_norm_count < textord_noise_sncount`should always be added here.
bool rejected = dot_count > norm_count * textord_noise_normratio &&
dot_count > 2;
if (textord_noise_debug) {
tprintf("Row ending at (%d,%g):", blob_box.right(), row->base_line(blob_box.right()));
tprintf(" R=%g, dc=%d, nc=%d, %s\n",
norm_count > 0 ? static_cast<float>(dot_count) / norm_count : 9999, dot_count,
norm_count,
dot_count > norm_count * textord_noise_normratio && dot_count > 2 ? "REJECTED"
: "ACCEPTED");
rejected? "REJECTED": "ACCEPTED");
}
return super_norm_count < textord_noise_sncount &&
dot_count > norm_count * textord_noise_rowratio && dot_count > 2;
return super_norm_count < textord_noise_sncount && rejected;
}
/**********************************************************************