当前位置:网站首页>[OCR] aspriseocr C # English, number recognition (not Chinese)
[OCR] aspriseocr C # English, number recognition (not Chinese)
2022-06-12 14:21:00 【Ten year dream Lab】
Original picture
One 、AspriseOCR 4.0 Cracked versions
Recognition effect
x86
C# Source code
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 Transition button event
// Transition button event
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; // Picture path
if (String.IsNullOrEmpty(img_path)) // Image non empty verification
{
MessageBox.Show(" Please select the picture first !");
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 Browse Events
// Browse Events
private void btn_imgpath_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
txt_imgpath.Text = openFileDialog1.FileName;
}
// Browse the pictures
private void txt_imgpath_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
txt_imgpath.Text = openFileDialog1.FileName;
}
#endregion
}
}
Two 、AspriseOCR 15.3
Recognition effect (x64)
Source code :
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 Transition button event
// Transition button event
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; // Picture path
if (String.IsNullOrEmpty(img_path)) // Image non empty verification
{
MessageBox.Show(" Please select the picture first !");
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 Browse Events
// Browse Events
private void btn_imgpath_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
txt_imgpath.Text = openFileDialog1.FileName;
}
// Browse the pictures
private void txt_imgpath_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
txt_imgpath.Text = openFileDialog1.FileName;
}
#endregion
}
}
Reference resources :
LanTenggit/orc: orc Image recognition (MODI) (github.com)https://github.com/LanTenggit/orc
边栏推荐
- Redis data deletion policy in 2022
- 华为设备配置OSPF伪连接
- Server concurrency - note 1
- Alicloud development board vscode development environment setup
- Mold and remainder
- Reverse the encryption parameters of a hot water software
- Player practice 15 xdemux and avcodecparameters
- Briefly describe the difference between CGI and fastcgi
- Llvm pass-- virtual function protection
- CUDA error: CUBLAS_ STATUS_ NOT_ INITIALIZED when calling `cublasCreate(handle)`
猜你喜欢
【活动早知道】LiveVideoStack近期活动一览
What is automatic bidding? What are its advantages?
高考回忆录
Leetcode 2185. Counts the string containing the given prefix
Leetcode 2176. Count equal and divisible pairs in an array
Mémoire de l'examen d'entrée à l'université
Player actual combat 21 audio and video synchronization
Display logs in the database through loganalyzer
Player practice 15 xdemux and avcodecparameters
初学者入门阿里云haas510开板式DTU(2.0版本)--510-AS
随机推荐
Player practice 19 xaudio turn on audio
If you want to build brand awareness, what bidding strategy can you choose?
Codeforces Round #798 (Div. 2)(A~D)
Visual studio common shortcuts
Llvm 13.1 new pass plug-in form [for win]
Codeforces Round #798 (Div. 2)(A~D)
对某热水软件的加密参数逆向
CUDA error: CUBLAS_ STATUS_ NOT_ INITIALIZED when calling `cublasCreate(handle)`
Lua common built-in functions
Leetcode 2176. Count equal and divisible pairs in an array
Alicloud development board vscode development environment setup
NotePad 常用设置
[MySQL] basic database operation
Player actual combat 21 audio and video synchronization
工具笔记 —— 常用自定义工具类(正则,随机数等)
QT database realizes page turning function
[early knowledge of activities] list of recent activities of livevideostack
How to set, reset and reverse bit
Des File Encryptor based on MFC framework
PMP敏捷知识点