简体   繁体   中英

Can't run OpenCV Emgu.CV

Using the PM I installed Emgu.CV to my solution and wrote this very simple code:

    using (var img = new Image<Bgr, byte>("img4.png"))
    {
        using (var provider = new Tesseract("", "eng", OcrEngineMode.TesseractCubeCombined))
        {
            provider.Recognize(img);

            var chars = provider.GetCharacters();

            var text = provider.GetText().TrimEnd();
        }
    }

For some strange reason, when I run the app, I get the exceptions: 1) The console displays the following: error opening data file ./tessdata/eng.traineddata 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

2) And the exception error in the code: {"Unable to create ocr model using Path 'c:\\users\\jdoe\\documents\\visual studio 2015\\Projects\\OpenCV_ImgToText\\OpenCV_ImgToText\\bin\\Debug' and language 'eng'."}

Well, first of all I am not sure if I had to install anything before running this code. I donwloaded the package from emgu.com, unzipped it but there is only the source code, so nothing to install I also changed the folder permission to OpenCV_ImgToText, so now it can write the files into it. But the erorr still pops up. Please advise.

I have used OpenCV once. Following documentation helped me to create simple application with WCF.

http://www.emgu.com/wiki/index.php/Download_And_Installation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM