使用C#进行OCR读取 [英] OCR reading using C#

查看:823
本文介绍了使用C#进行OCR读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,该项目要读取捕获的图像中的字符,但是我被卡在要扫描图像的按钮上.我最终在c#中找到了tesseract dll,但是我不知道该如何编码.我是这个程序设计的新手.

I have a project which is to read character in a captured image but I'm stuck at the button which is to scan image. I ended up tesseract dll in c#, but I don't know how can I code it. I'm a newbie to this programming.

 private void Browse_Click(object sender, EventArgs e)
    {
        //FileInfo fi = new FileInfo(string.Format(@"C:\Documents and Settings\JOrce0201610\My Documents\Visual Studio 2005\Projects\OCR Reader\{0}", imageName));
        OpenFileDialog fi = new OpenFileDialog();
        fi.InitialDirectory = @"C:\\Documents and Settings\JOrce0201610\My Documents\Visual Studio 2005\Projects\OCR Reader\Card";
        fi.Filter = "BMP Image|*.bmp";
        fi.FilterIndex = 2;
        fi.RestoreDirectory = true;
        if (fi.ShowDialog() == DialogResult.OK)
        {
            //image file path
            textBox1.Text = fi.FileName;
            //display image in picture box
            pictureBox1.Image = new Bitmap(fi.FileName);
        }
    }
    private void Scan_Click(object sender, EventArgs e)
    {
        Bitmap temp = source.Clone() as Bitmap; //Clone image to keep original image

        FiltersSequence seq = new FiltersSequence();
        seq.Add(Grayscale.CommonAlgorithms.BT709);  //First add  GrayScaling filter
        seq.Add(new OtsuThreshold()); //Then add binarization(thresholding) filter
        temp = seq.Apply(source); // Apply filters on source image

推荐答案

如果您是编程的新手",OCR并不是最好的起点.我所建议的最好是,您可以使用网络服务或现有的库来为您执行此操作.

If you are a 'newbie' to programming, OCR is not the best place to start. The best I can suggest is that you use a webservice or existing library that can do this for you.

Microsoft有项目夏威夷,夏威夷的OCR服务相当易于使用.

Microsoft has project Hawaii, Hawaii has an OCR service which is quite easy to use.

这篇关于使用C#进行OCR读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆