mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-11 23:19:04 +08:00
OSD: Print script name instead of meaningless script id
This commit is contained in:
parent
0fdfa98c0f
commit
79ed9a30c7
@ -32,6 +32,7 @@
|
|||||||
#include "tprintf.h"
|
#include "tprintf.h"
|
||||||
#include "openclwrapper.h"
|
#include "openclwrapper.h"
|
||||||
#include "osdetect.h"
|
#include "osdetect.h"
|
||||||
|
#include "unicharset.h"
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* main()
|
* main()
|
||||||
@ -257,13 +258,17 @@ int main(int argc, char **argv) {
|
|||||||
if (api.DetectOS(&osr)) {
|
if (api.DetectOS(&osr)) {
|
||||||
int orient = osr.best_result.orientation_id;
|
int orient = osr.best_result.orientation_id;
|
||||||
int script_id = osr.get_best_script(orient);
|
int script_id = osr.get_best_script(orient);
|
||||||
|
const char* script_name =
|
||||||
|
osr.unicharset->get_script_from_script_id(script_id);
|
||||||
float orient_oco = osr.best_result.oconfidence;
|
float orient_oco = osr.best_result.oconfidence;
|
||||||
float orient_sco = osr.best_result.sconfidence;
|
float orient_sco = osr.best_result.sconfidence;
|
||||||
tprintf("Orientation: %d\nOrientation in degrees: %d\n" \
|
tprintf("Orientation: %d\n"
|
||||||
"Orientation confidence: %.2f\n" \
|
"Orientation in degrees: %d\n"
|
||||||
"Script: %d\nScript confidence: %.2f\n",
|
"Orientation confidence: %.2f\n"
|
||||||
|
"Script: %s\n"
|
||||||
|
"Script confidence: %.2f\n",
|
||||||
orient, OrientationIdToValue(orient), orient_oco,
|
orient, OrientationIdToValue(orient), orient_oco,
|
||||||
script_id, orient_sco);
|
script_name, orient_sco);
|
||||||
} else {
|
} else {
|
||||||
ret_val = 1;
|
ret_val = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user