Hello everybody,
for my project I needed to convert images to text. I read the forum tutorials, but at the end I decided to write an extension.
For this purpose I used the API of ocr.space.
First step You have to register to have your free api key.
To get the text from a file in your phone
objectLocation: the file path in your phone
apiKey: your Api Key provided by OCRSpace
language: Language used for OCR (on ocr.space website you find the possible values)
fileType: supported image file formats (on ocr.space website you find the possible values)
scale: true or false, this can improve the OCR result
ocrEngine: 1,2 or 3 see specifications on Free OCR API
To get the text from a URL
url: the file position in the web
apiKey: your Api Key provided by OCRSpace
language: Language used for OCR (on ocr.space website you find the possible values)
If the responseCode is Ok you will find the OCR result on parsedText
here is an example of how to perform OCR with URL and File
Source Code:
OCRSpace.txt (12.2 KB)
Extension:
OCRSpace.aix (17.8 KB)
Sample Project:
OCR.aia (22.6 KB)
How works the sample project:
Select Language (for FILE and URL), File Type and OCR Engine (only for FILE)
If You want an OCR from URL write the URL in the Text Box and then click on "Get URL OCR"
If You want an OCR from File take a pic with some text and then click on "Get FILE OCR"
Try scale On or OFF or different OCR Engine to see the difference
I hope You find useful
Best Regards
Marco Perrone