LeadTools图像处理C#阅卷系统、OCR、OMR学习之路(一)

作者在学习LeadTools过程中尝试启动OCR引擎时遇到OCRcomponentmissing错误,推测可能缺少必要的组件,寻求解决方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天开始学习LeadTools

官网:leadtools.gcpowertools.com.cn

官网是纯英文的,废了不少劲,终于看个大概,先建立个demo测试下

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 System.IO;
using Leadtools;

using Leadtools.Ocr;
using Leadtools.Document.Writer;
using Leadtools.Codecs;

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

        static void SetLicense()
        {
            string license = @"C:\Users\a\Downloads\LEADTOOLS.v22\Support\Common\License\LEADTOOLS.LIC";
            string key = File.ReadAllText(@"C:\Users\a\Downloads\LEADTOOLS.v22\Support\Common\License\LEADTOOLS.LIC.KEY");
            RasterSupport.SetLicense(license, key);
            if (RasterSupport.KernelExpired)
                MessageBox.Show("License file invalid or expired.");
            else
                MessageBox.Show("License file set successfully");
            string workDir = @"C:\MyApp\OcrTemp";
            RasterCodecs codecs = new RasterCodecs();
           // Directory.Delete(workDir, true);


            using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD))
            {
                Console.WriteLine("Before calling Startup, IsStarted = " + ocrEngine.IsStarted);
                ocrEngine.Startup(codecs, null, workDir, LEAD_VARS.OcrLEADRuntimeDir);
                //ocrEngine.Shutdown();

            }

        }
    }
    static class LEAD_VARS
    {
        public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
        public const string OcrLEADRuntimeDir = @"D:\system\group-office-automation\";
    }
}

运行的结果SetLicense是成功的,但是在启动Ocr引擎的时候一直提示:

名称类型
$exception{"OCR component missing"}Leadtools.Ocr.OcrException

查询官网发现错误是:缺少OCR组件,卡住了,猜想是肯定少安装了组件,有大神知道了欢迎支招,我先翻看官网研究吧.....

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值