基本信息
源码名称:星魂OCR识别 示例源码
源码大小:0.76M
文件格式:.rar
开发语言:C#
更新时间:2018-04-15
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
很久以前采集星魂黄页站的电话号码
很久以前采集星魂黄页站的电话号码
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.Net;
using System.Runtime.InteropServices;
using System.IO;
namespace 星魂ocr识别
{
public partial class Form1 : Form
{
[DllImport("AspriseOCR.dll", EntryPoint = "OCR")]
public static extern IntPtr OCR(string file, int type);
[DllImport("AspriseOCR.dll", EntryPoint = "OCRpart")]
static extern IntPtr OCRpart(string file, int type, int startX, int startY, int width, int height);
[DllImport("AspriseOCR.dll", EntryPoint = "OCRBarCodes")]
static extern IntPtr OCRBarCodes(string file, int type);
[DllImport("AspriseOCR.dll", EntryPoint = "OCRpartBarCodes")]
static extern IntPtr OCRpartBarCodes(string file, int type, int startX, int startY, int width, int height);
public Form1()
{
InitializeComponent();
}
//自定义截取字符串;用来给图片重命名
public string getstr(string url)
{
string[] sArray = url.Split('/');
return sArray[4];
}
//识别图片
public string shibie(string myimage)
{
string ret;
ret = Marshal.PtrToStringAnsi(OCR(myimage, -1));
string str = ret.Replace(Environment.NewLine, "");
return str;
}
private void button1_Click(object sender, EventArgs e)
{
string spath = @"D:\\Qincai\";
if (!Directory.Exists(spath))
{
Directory.CreateDirectory(spath);
}
for (int a = Convert.ToInt32(textBox1.Text); a < Convert.ToInt32(textBox2.Text); a )
{
if (a % 500==0)
{
}
string url1 = "http://www.qincai.net/png/district_" a ".png";
string url2 = "http://www.qincai.net/png/tele_" a ".png";
string url3 = "http://www.qincai.net/png/fax_" a ".png";
string filepath1 = "D:\\Qincai\\district_" a ".png";
string filepath2 = "D:\\Qincai\\tele_" a ".png";
string filepath3 = "D:\\Qincai\\fax_" a ".png";
WebClient mywebclient = new WebClient();
mywebclient.Headers.Add("Referer", "http://www.qincai.net");
mywebclient.DownloadFile(url1, filepath1);
mywebclient.Headers.Add("Referer", "http://www.qincai.net");
mywebclient.DownloadFile(url2, filepath2);
mywebclient.Headers.Add("Referer", "http://www.qincai.net");
mywebclient.DownloadFile(url3, filepath3);
string textline;
textline = "ID," a ",手机," shibie(filepath1) ",电话," shibie(filepath2) ",传真," shibie(filepath3);
FileStream fs = new FileStream("D:\\phone.txt",FileMode.Append);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(textline);
sw.Close();
fs.Close();
}
}
}
}