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 图片识别 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { DialogResult dr = openFileDialog1.ShowDialog(this); textBox1.Text = openFileDialog1.FileName; } private void button2_Click(object sender, EventArgs e) { richTextBox1.Text = Marshal.PtrToStringAnsi(OCR(textBox1.Text, -1)); //MessageBox.Show(Marshal.PtrToStringAnsi(OCRpart(img_path, -1, startX, startY, width, height))); } } }
需要引入一个DLL AspriseOCR.dll 这个可以从网上下载