zoukankan      html  css  js  c++  java
  • OCR图像识别技术-Asprise OCR

    // csc AspriseDemo.cs /r:AspriseOcr.dll
    // 注意注册:AspriseOCR.InputLicense("123456", "123456789123456789123456789");
    // http://asprise.com/ocr/docs/html/asprise-ocr-library-csharp-vb.net-component.html
    using System;
    using AspriseOcr;
    
    namespace AspriseDemo
    {
        class Program
        {
            static void Main(string[] args)
            {
                AspriseOCR.SetUp();
                AspriseOCR.InputLicense("123456", "123456789123456789123456789");
                AspriseOCR ocr = new AspriseOCR();
                ocr.StartEngine("eng", AspriseOCR.SPEED_FASTEST);
                string s = ocr.Recognize(@".demo.png", -1, -1, -1, -1, -1,AspriseOCR.RECOGNIZE_TYPE_ALL, AspriseOCR.OUTPUT_FORMAT_PLAINTEXT);
                /* 支持识别类型 PDF,TIF,PNG,JPG,
                //TEXT ONLY
                s = ocr.Recognize(@"C:pathimg.jpg", -1, -1, -1, -1, -1,AspriseOCR.RECOGNIZE_TYPE_TEXT, AspriseOCR.OUTPUT_FORMAT_PLAINTEXT);
                //BARCODE ONLY
                s = ocr.Recognize(@"C:pathimg.jpg", -1, -1, -1, -1, -1,AspriseOCR.RECOGNIZE_TYPE_BARCODE, AspriseOCR.OUTPUT_FORMAT_PLAINTEXT);
                //PART OF IMAGE
                s = ocr.Recognize(@"C:pathimg.jpg", -1, 0, 0, 400, 200, AspriseOCR.RECOGNIZE_TYPE_ALL, AspriseOCR.OUTPUT_FORMAT_PLAINTEXT);
                //More Image
                s = ocr.Recognize(@"C:img1.jpg;C:img2.png", -1, -1, -1, -1, -1,AspriseOCR.RECOGNIZE_TYPE_ALL, AspriseOCR.OUTPUT_FORMAT_PLAINTEXT);
                //可以使用字典
                //ocr.StartEngine("eng", AspriseOCR.SPEED_FASTEST,"START_PROP_DICT_CUSTOM_DICT_FILE=dict.txt");
                s = ocr.Recognize("image.png", -1, -1, -1, -1, -1, AspriseOCR.RECOGNIZE_TYPE_ALL, AspriseOCR.OUTPUT_FORMAT_PLAINTEXT);
                //将识别结果存为 PDF
                ocr.Recognize(@"C:	est-image.png", -1, -1, -1, -1, -1, Ocr.RECOGNIZE_TYPE_ALL, Ocr.OUTPUT_FORMAT_PDF,
                    AspriseOCR.PROP_PDF_OUTPUT_FILE, "ocr-result.pdf",  AspriseOCR.PROP_PDF_OUTPUT_TEXT_VISIBLE, true);
                */
                Console.WriteLine(s);
                ocr.StopEngine();
                Console.ReadKey();
            }
        }
    }
    
  • 相关阅读:
    161012、JAVA读写文件,如何避免中文乱码
    161011、oracle批量插入数据
    161010、在大型项目中组织CSS
    160930、Javascript的垃圾回收机制与内存管理
    160929、各数据库连接配置与maven依赖安装
    Selenium学习(8) Cookie处理
    Selenium学习(7) 文件上传
    Selenium学习(6) 控制浏览器操作
    Selenium学习(5) 元素等待
    Selenium学习(4) 键盘操作
  • 原文地址:https://www.cnblogs.com/flaaash/p/5395926.html
Copyright © 2011-2022 走看看