Skip to content

Commit dcfdd5c

Browse files
committed
OSD: Print script name instead of meaningless script id
1 parent 8640796 commit dcfdd5c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

api/tesseractmain.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "tprintf.h"
3333
#include "openclwrapper.h"
3434
#include "osdetect.h"
35+
#include "unicharset.h"
3536

3637
/**********************************************************************
3738
* main()
@@ -257,13 +258,17 @@ int main(int argc, char **argv) {
257258
if (api.DetectOS(&osr)) {
258259
int orient = osr.best_result.orientation_id;
259260
int script_id = osr.get_best_script(orient);
261+
const char* script_name =
262+
osr.unicharset->get_script_from_script_id(script_id);
260263
float orient_oco = osr.best_result.oconfidence;
261264
float orient_sco = osr.best_result.sconfidence;
262-
tprintf("Orientation: %d\nOrientation in degrees: %d\n" \
263-
"Orientation confidence: %.2f\n" \
264-
"Script: %d\nScript confidence: %.2f\n",
265+
tprintf("Orientation: %d\n"
266+
"Orientation in degrees: %d\n"
267+
"Orientation confidence: %.2f\n"
268+
"Script: %s\n"
269+
"Script confidence: %.2f\n",
265270
orient, OrientationIdToValue(orient), orient_oco,
266-
script_id, orient_sco);
271+
script_name, orient_sco);
267272
} else {
268273
ret_val = 1;
269274
}

0 commit comments

Comments
 (0)