码迷,mamicode.com
首页 > Web开发 > 详细

OCR图像识别技术-Asprise OCR

时间:2016-04-15 16:46:32      阅读:576      评论:0      收藏:0      [点我收藏+]

标签:

// 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:\path\img.jpg", -1, -1, -1, -1, -1,AspriseOCR.RECOGNIZE_TYPE_TEXT, AspriseOCR.OUTPUT_FORMAT_PLAINTEXT);
            //BARCODE ONLY
            s = ocr.Recognize(@"C:\path\img.jpg", -1, -1, -1, -1, -1,AspriseOCR.RECOGNIZE_TYPE_BARCODE, AspriseOCR.OUTPUT_FORMAT_PLAINTEXT);
            //PART OF IMAGE
            s = ocr.Recognize(@"C:\path\img.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:\test-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();
        }
    }
}

OCR图像识别技术-Asprise OCR

标签:

原文地址:http://www.cnblogs.com/flaaash/p/5395926.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!