0
votes

I am totally new to tesseract . So please don't mind if my question sounds a bit too nubby. I've downloaded tesseract using cocoapod and I've written the following code in my viewController :

import UIKit
import TesseractOCR


class ViewController: UIViewController ,G8TesseractDelegate {

    @IBOutlet weak var txtView: UITextView!


    override func viewDidLoad() {
        super.viewDidLoad()
        if  let tesseractOCR = G8Tesseract(language: "eng") {
            tesseractOCR.delegate = self
            tesseractOCR.image = UIImage(named: "test.png")?.g8_grayScale()
            tesseractOCR.recognize()


            txtView.text = tesseractOCR.recognizedText

        }




    }


    func progressImageRecognition(for tesseract: G8Tesseract!) {
        print("the regignision is in progress by \(tesseract.progress)+ %")
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

And then I went to the following link to download the English language . https://github.com/tesseract-ocr/tessdata/blob/master/eng.traineddata and then moved the downloaded file to my project as you can see in the image enter image description here

Does any one know how can I fix this ? Here is the error in the console : Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory. Failed loading language 'eng' Tesseract couldn't load any languages!

1
The error says "tessdata" directory. You need to have a tessdata directory, in which the eng.traineddata file resides. This directory should be in the same directory as the tesseract executable.sashoalm

1 Answers

0
votes

The error says "tessdata" directory. You need to have a tessdata directory, in which the eng.traineddata file resides. This directory should be in the same directory as the tesseract executable.

See Tesseract running error