2014-10-08 26 views
6

Sono nuovo in tesseract OCR. Ho provato a convertire un'immagine in tif ed eseguirla per vedere quale output di tesseract utilizzava cmd in windows, ma non potevo. Mi potete aiutare? Quale sarà il comando da usare?Posso testare tesseract ocr nella riga di comando di Windows?

Qui è la mia immagine di esempio:

enter image description here

+0

Si prega di spiegare ciò che si ho provato più in dettaglio. – Vish

+0

@Vish Ho installato la libreria tesseract dal suo sito. e da cmd ho provato a convertire l'immagine del testo. l'output di tesseract imagename.tif. Ma non è stato possibile ottenere alcun risultato. – Akunar

+0

Per la sintassi digitata, l'output è archiviato in un file, output.txt. Hai controllato che un tale file è stato creato? Inoltre, puoi caricare il tuo file TIF da qualche parte? Se avrò un po 'di tempo posso controllare con la mia installazione di tesseract. – Vish

risposta

12

Il più semplice tesseract.exe sintassi è tesseract.exe inputimage output-text-file. L'assunto qui è che tesseract.exe viene aggiunto alla variabile di ambiente PATH. È possibile aggiungere l'argomento -psm N se l'argomento del testo è particolarmente difficile da riconoscere.

Vedo che la sintassi regolare (senza gli switch -psm) funziona correttamente con l'immagine allegata, a meno che il livello di precisione non sia abbastanza buono.

Nota che i caratteri non inglesi (come il simbolo accanto alla prescrizione) non sono riconosciuti; la mia installazione predefinita contiene solo i dati di allenamento in inglese.

Ecco la descrizione della sintassi tesseract:

C:\Users\vish\Desktop>tesseract.exe 
Usage:tesseract.exe imagename outputbase [-l lang] [-psm pagesegmode] [configfile...] 

pagesegmode values are: 
0 = Orientation and script detection (OSD) only. 
1 = Automatic page segmentation with OSD. 
2 = Automatic page segmentation, but no OSD, or OCR 
3 = Fully automatic page segmentation, but no OSD. (Default) 
4 = Assume a single column of text of variable sizes. 
5 = Assume a single uniform block of vertically aligned text. 
6 = Assume a single uniform block of text. 
7 = Treat the image as a single text line. 
8 = Treat the image as a single word. 
9 = Treat the image as a single word in a circle. 
10 = Treat the image as a single character. 
-l lang and/or -psm pagesegmode must occur before anyconfigfile. 

Single options: 
    -v --version: version info 
    --list-langs: list available languages for tesseract engine 

Ed ecco l'output per l'immagine (NOTA: quando ho scaricato, è convertito in un'immagine PNG):

C:\Users\vish\Desktop>tesseract.exe ECL8R.png out.txt 
Tesseract Open Source OCR Engine v3.02 with Leptonica 

C:\Users\vish\Desktop>type out.txt.txt 
1 Project Background 

A prescription (R) is a written order by a physician or medical doctor to a pharmacist in the form of 
medication instructions for an individual patient. You can't get prescription medicines unless someone 
with authority prescribes them. Usually, this means a written prescription from your doctor. Dentists, 

optometrists, midwives and nurse practitioners may also be authorized to prescribe medicines for you. 

It can also be defined as an order to take certain medications. 

A prescription has legal implications; this means the prescriber must assume his responsibility for the 
clinical care ofthe patient. 

Recently, the term "prescriptionΓÇ¥ has known a wider usage being used for clinical assessments, 
Problemi correlati