zoukankan      html  css  js  c++  java
  • Asprise-OCR的使用

    Asprise-OCR下载地址:

    http://asprise.com/product/ocr/download.php?lang=csharp 

    其中需要使用的3个dll是AspriseOCR.dll、DevIL.dll、ILU.dll。

    需要注意的是这几个.dll是vc写的引用要在程序中用DllImport引用,关键代码:

    [DllImport("AspriseOCR.dll", EntryPoint = "OCR", CallingConvention = CallingConvention.Cdecl)]

    public static extern IntPtr OCR(string file, int type);

    [DllImport("AspriseOCR.dll", EntryPoint = "OCRpart", CallingConvention = CallingConvention.Cdecl)]

    static extern IntPtr OCRpart(string file, int type, int startX, int startY, int width, int height);

    [DllImport("AspriseOCR.dll", EntryPoint = "OCRBarCodes", CallingConvention = CallingConvention.Cdecl)]

    static extern IntPtr OCRBarCodes(string file, int type);

    [DllImport("AspriseOCR.dll", EntryPoint = "OCRpartBarCodes", CallingConvention = CallingConvention.Cdecl)]

    static extern IntPtr OCRpartBarCodes(string file, int type, int startX, int startY, int width, int height);

     

    调用代码很简单只有一句:

    MessageBox.Show(Marshal.PtrToStringAnsi(OCRpart(img_path, -1, startX, startY, width, height)));

    其中img_path:为图片路径,startX、startY坐标均为0即可,width、height图片的宽和高。

  • 相关阅读:
    网站精准查询IP
    JQuery插件模板
    SQLSERVER 数据从一张那个表复制到另一张表
    C# 取form表单的数据
    C# 判断网络文件是否存在
    C# 将文件转换为 Stream
    C# 将 Stream 写入文件
    JDBC教程
    Spring Boot教程
    JavaMail
  • 原文地址:https://www.cnblogs.com/wonder315/p/4343794.html
Copyright © 2011-2022 走看看