System.TypeInitializationException: 'The type initializer for 'Emgu.CV.OCR.Tesseract' threw an exception.'

0

I am designing an app that utilizes Emgu.CV.OCR, in which a component know as the Tesseract is utilized. While the IDE does state that the code is correct and has no errors, there is a problem with it running with it resulting in this error. It states the reason for this error is:

"DllNotFoundException: Unable to load DLL 'opencv_core240': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

I believe the error may have to deal with a pathway, but still:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Emgu.CV;
using Emgu.Util;
using Emgu.CV.OCR;
using Emgu.CV.Structure;

namespace Acatek_Text_Extractor
{
    public partial class Form1 : Form
    {
        private Tesseract OCRz = new Tesseract("tessdata", "eng", Tesseract.OcrEngineMode.OEM_TESSERACT_ONLY);
        private Bitmap pic = new Bitmap(460, 272);
        private Graphics gfx;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            gfx.CopyFromScreen(new Point(this.Location.X + Visual.Location.X + 4, this.Location.Y + Visual.Location.Y + 30), new Point(0, 0), pic.Size);
            Visual.Image = pic;
        }

        private void ExtractBtn_Click(object sender, EventArgs e)
        {
            OCRz.Recognize(new Image<Bgr, byte>(pic));
            RichTextBox.Text = OCRz.GetText();
        }
    }

}
c#
opencv
emgucv
asked on Stack Overflow Jun 15, 2020 by Acatek Software

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0