当前位置:网站首页>【OCR】AspriseOCR C# 英文、數字識別(中文不行)
【OCR】AspriseOCR C# 英文、數字識別(中文不行)
2022-06-12 14:20:00 【十年一夢實驗室】

原圖
一、AspriseOCR 4.0 破解版

識別效果

x86
C#源碼
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.Runtime.InteropServices;
namespace ToText
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
#region 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);
#endregion
#region 轉換按鈕事件
// 轉換按鈕事件
private void button2_Click(object sender, EventArgs e)
{
int startX = 0;
int startY = 0;
int width = -1;
int height = -1;
string img_path = txt_imgpath.Text; // 圖片路徑
if (String.IsNullOrEmpty(img_path)) // 圖片非空驗證
{
MessageBox.Show("請先選擇圖片!");
return;
}
try
{
Image img = Image.FromFile(img_path);
width = img.Width;
height = img.Height;
}
catch (Exception ex)
{
MessageBox.Show(ex.StackTrace);
}
txt_result.Text = Marshal.PtrToStringAnsi(OCRpart(img_path, -1, startX, startY, width, height));
}
#endregion
#region 瀏覽事件
// 瀏覽事件
private void btn_imgpath_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
txt_imgpath.Text = openFileDialog1.FileName;
}
// 瀏覽圖片
private void txt_imgpath_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
txt_imgpath.Text = openFileDialog1.FileName;
}
#endregion
}
}
二、AspriseOCR 15.3



識別效果(x64)
源碼:
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.Runtime.InteropServices;
using asprise_ocr_api;
namespace ToText
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
#region 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);
#endregion
#region 轉換按鈕事件
// 轉換按鈕事件
private void button2_Click(object sender, EventArgs e)
{
int startX = 0;
int startY = 0;
int width = -1;
int height = -1;
string img_path = txt_imgpath.Text; // 圖片路徑
if (String.IsNullOrEmpty(img_path)) // 圖片非空驗證
{
MessageBox.Show("請先選擇圖片!");
return;
}
try
{
Image img = Image.FromFile(img_path);
width = img.Width;
height = img.Height;
}
catch (Exception ex)
{
MessageBox.Show(ex.StackTrace);
}
// txt_result.Text = Marshal.PtrToStringAnsi(OCRpart(img_path, -1, startX, startY, width, height));
AspriseOCR.SetUp();
AspriseOCR ocr = new AspriseOCR();
ocr.StartEngine("eng", AspriseOCR.SPEED_FASTEST);
string s = ocr.Recognize(img_path, -1, -1, -1, -1, -1, AspriseOCR.RECOGNIZE_TYPE_ALL, AspriseOCR.OUTPUT_FORMAT_PLAINTEXT);
ocr.StopEngine();
txt_result.Text = s;
}
#endregion
#region 瀏覽事件
// 瀏覽事件
private void btn_imgpath_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
txt_imgpath.Text = openFileDialog1.FileName;
}
// 瀏覽圖片
private void txt_imgpath_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
txt_imgpath.Text = openFileDialog1.FileName;
}
#endregion
}
}
參考:
LanTenggit/orc: orc圖片識別(MODI) (github.com)
https://github.com/LanTenggit/orc
边栏推荐
- SystemC uses SC_ report_ Handler processing log printing
- 对于跨境电商,更侧重收入的出价策略 —Google SEM
- Create a slice slice pit using the make method
- 工具笔记 —— 常用自定义工具类(正则,随机数等)
- Player practice 26 adding slider and window maximization
- 肝了一个月的原创小袁个人博客项目开源啦(博客基本功能都有,还包含后台管理)
- 华为设备配置BGP AS号替换
- SystemC:SC_ Thread and SC_ METHOD
- Codeforces Round #798 (Div. 2)(A~D)
- Detailed explanation of C language memset
猜你喜欢

Dynamic search advertising intelligent search for matching keywords

PostgreSQL14安装使用教程

通信流量分析

【活动早知道】LiveVideoStack近期活动一览

Alibaba cloud development board haas510 parses serial port JSON data and sends attributes

2022版Redis数据删除策略

Introduction to database system (Fifth Edition) notes Chapter 1 Introduction

Player actual combat 14 display YUV

对某热水软件的加密参数逆向

华为设备配置H虚拟专用网
随机推荐
Unhandled exception stack overflow
Copy word content to excel and automatically divide it into multiple columns
Leetcode 2185. 统计包含给定前缀的字符串
Bridging and net
测试工程师如何转型测开
Detailed explanation of C language memset
[advanced MySQL] evolution of MySQL index data structure (IV)
Reverse the encryption parameters of a hot water software
Tool notes - common custom tool classes (regular, random, etc.)
对于跨境电商,更侧重收入的出价策略 —Google SEM
华为设备配置BGP AS号替换
Leetcode questions brushing February /1020 Number of enclaves
SystemC simulation scheduling mechanism
QA of some high frequency problems in oauth2 learning
Conversion of player's actual 10 pixel format and size
Analysis of lua source code
【OCR】AspriseOCR C# 英文、数字识别(中文不行)
如果要打造品牌知名度,可以选择什么出价策略?
Pay attention to click and pursue more users to enter the website. What bidding strategy can you choose?
通信流量分析