Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix confidence output for the PAGE XML renderer #4283

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/api/pagerenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,10 @@ char *TessBaseAPI::GetPAGEText(ETEXT_DESC *monitor, int page_number) {
<< "\" caption=\"Regions reading order\">\n";

ResultIterator *res_it = GetIterator();

float block_conf = 0;
float line_conf = 0;

while (!res_it->Empty(RIL_BLOCK)) {
if (res_it->Empty(RIL_WORD)) {
res_it->Next(RIL_WORD);
Expand Down Expand Up @@ -825,7 +829,6 @@ char *TessBaseAPI::GetPAGEText(ETEXT_DESC *monitor, int page_number) {
break;
}

float block_conf = 0;
if (res_it->IsAtBeginningOf(RIL_BLOCK)) {
// Add Block to reading order
reading_order_str << "\t\t\t\t<RegionRefIndexed " << "index=\"" << rcnt
Expand Down Expand Up @@ -871,8 +874,7 @@ char *TessBaseAPI::GetPAGEText(ETEXT_DESC *monitor, int page_number) {
// for now using LinePts
bool skewed_flag = (orientation_block != ORIENTATION_PAGE_UP &&
orientation_block != ORIENTATION_PAGE_DOWN);

float line_conf = 0;

if (res_it->IsAtBeginningOf(RIL_TEXTLINE)) {
// writing_direction_before = writing_direction;
line_conf = ((res_it->Confidence(RIL_TEXTLINE)) / 100.);
Expand Down
Loading