Sto usando tess4j, il wrapper java di Tesseract. Ho anche installato il normale Tesseract. Non sono esattamente sicuro di come debba funzionare tass4j, ma dal momento che viene fornito con una cartella tessdata, posso supporre che inseriresti i file di dati della lingua lì. Tuttavia, tess4j funziona solo se i file di dati della lingua si trovano nella cartella "reale" di tessdata (quella che viene fornita con tesseract, non tess4j). Se rimuovo quella cartella, ricevo questo messaggio di errore:Tess4j non usa la cartella tessdata
Error opening data file C:\Program Files\Tesseract-OCR\tessdata/jpn.trained
data
Please make sure the TESSDATA_PREFIX environment variable is set to the par
ent directory of your "tessdata" directory.
Failed loading language 'jpn'
Tesseract couldn't load any languages!
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x631259dc, pid=5108, tid=
10148
#
# JRE version: 7.0_06-b24
# Java VM: Java HotSpot(TM) Client VM (23.2-b09 mixed mode, sharing windows
-x86)
# Problematic frame:
# C [libtesseract302.dll+0x59dc] STRING::strdup+0x467c
#
# Failed to write core dump. Minidumps are not enabled by default on client
versions of Windows
#
# An error report file with more information is saved as:
# D:\School\Programs\OCRTest\v1.0.0\hs_err_pid5108.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Significa questo ho bisogno di avere Tesseract installato per usare tess4j? Perché? Oppure maby mia tess4j tessdata folder è nel posto sbagliato (è attualmente con i miei file .java, i tess4j jars sono in una cartella lib a cui ho impostato un classpath).
cosa succede se lasci che la tua 'variabile d'ambiente TESSDATA_PREFIX' punti alla cartella tessdata del tuo Tess4J? – sschrass
Bene, questo risolve il mio problema. Ho bisogno di diventare più abituato alle variabili ambientali per evitare queste difficoltà. Ancora una domanda: tutto funzionerebbe ancora se dovessi eseguire il programma su un altro computer che potrebbe non avere il percorso impostato? –