Tesseract Code不工作?

时间:2013-12-13 03:25:38

标签: c# tesseract

我在C#中有这个代码。我添加了tessnet2引用,但它仍然不起作用。表单加载但如果添加行tessnet2.Tesseract tessocr = new tessnet2.Tesseract();
则没有任何反应 在Form_Load事件上。如果我将其删除,则会显示console.writeline。我不明白发生了什么,有什么我在这里失踪的吗?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using tessnet2;
using System.Threading;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        Ocr ocr = new Ocr();
        using (Bitmap bmp = new Bitmap(@"C:\Users\jc\Desktop\test2.png"))
        {
            Console.WriteLine("ASdsa");
            tessnet2.Tesseract tessocr = new tessnet2.Tesseract();
            //tessocr.Init(null, "eng", false);
            //tessocr.GetThresholdedImage(bmp, Rectangle.Empty).Save("c:\\temp\\" + Guid.NewGuid().ToString() + ".bmp");
            //// Tessdata directory must be in the directory than this exe
            //Console.WriteLine("Multithread version");
            //ocr.DoOCRMultiThred(bmp, "eng");
            //Console.WriteLine("Normal version");
            //ocr.DoOCRNormal(bmp, "eng");
        }
    }
}
public class Ocr
{ .... some codes here ....}
}

0 个答案:

没有答案