再看 AspriseOCR - OCR应用开发 -20151124
再看 AspriseOCR - OCR应用开发
我写这个博文时间为 2015/11/24日,注意时间因为,网上很多文章时间上很久远,有的已经不能参考了
很多人面对从图片中识别文字或者数字0~9 A~Z 的时候都想网上查找相关的技术文章
我也找了很多,但是很可惜没有找到多少有价值的信息
大部分的信息都很老旧而且有关 AspriseOCR 的不少
尤其关于DELPHI + AspriseOCR 的更少
我从网上找到了 AspriseOCR 破解的文件 , 并且已经打包在我的上传资料上,你们可以去下载 AspriseOCR - Crake.zip
我的开发环境 为 DELPHI7 +WIN8 64 位
这个应用有几点要注意
1. 识别的图片只能为 白底黑字 ,其他类型的图片不能正确
2. AspriseOCR.dll ,DevIL.dll ,ILU.dll
三个文件放在和你开发的APP同样的目录下
3. 调用DLL 函数定义为
//function OCR(imgname:string;imagetype:integer):PChar;stdcall;
// external 'AspriseOCR.dll';
function OCR(imgname:PChar;i:integer):PChar;stdcall;external 'AspriseOCR.dll';
function OCRBarCodes(imgname:string;imagetype:integer):PChar;stdcall;
external 'AspriseOCR.dll';
Function OCRpart(filename :String; imagetype:Integer; startX :Integer;
startY :Integer; width:Integer; height:Integer):PChar;stdcall;
external 'AspriseOCR.dll';
请看上面第一个函数的定义 OCR 的参数imagname String 或者 Pchar 哪个正确?
我可以告诉你们 都是可以编译通过的 而且 两种定义都是对的
所以很多事情需要自己验证
-----------------------
截图识别的 图片处理
//我的图列
//图片的2值化 - 网上大部分人的做法
function TFrmMain.CBmpTwoValues(Bmp:TBitmap;grayThreshold:Byte):TBitmap;
var
p: PByteArray;
Gray, x, y: Integer;
aBmp: TBitmap;
begin
aBmp:=TBitmap.Create;
//aBmp.Assign(Image1.Picture.Bitmap);
aBmp:=Bmp;
//设置为24位真彩色
aBmp.PixelFormat := pf24Bit;
randomize;
for y := 0 to aBmp.Height - 1 do
begin
p := aBmp.scanline[y];
for x := 0 to aBmp.Width - 1 do
begin
//一个象素点三个字节
// Y = 0.299 * R + 0.587 * G + 0.114 * B
Gray := Round(p[x * 3 + 2] * 0.3 + p[x * 3 + 1] * 0.59 +
p[x * 3] * 0.11);
if gray > grayThreshold then //全局阀值128
begin
p[x * 3] := 255;
p[x * 3 + 1] := 255;
p[x * 3 + 2] := 255;
end
else
begin
p[x * 3] := 0;
p[x * 3 + 1] := 0;
p[x * 3 + 2] := 0;
end;
end;
end;
//Image2.Picture.Bitmap.Assign(Bmp);
Result:=aBmp;
end;
//图片的2值化 - 我自己的做法(针对我的特定图片的)
function TFrmMain.CBmpBlackWhiteExe(aBmp: TBitmap;aMainColor:TColor;aMainTorl:Byte): TBitmap;
var
bm:TBitmap;
bx,by:Integer;
aColor:TColor;
aClr,aClg,aClb:Byte;
aChageColorEn:Boolean;
begin
bm:=TBitmap.Create;
bm:=aBmp;
for bx := 0 to bm.Width-1 do
begin
for by := 0 to bm.Height-1 do
begin
//clBlue = TColor($FF0000); clBlack = TColor($000000);
//clRed = TColor($0000FF);clWhite = TColor($FFFFFF);
//clLime = TColor($00FF00);
aColor:=bm.Canvas.Pixels[bx,by];
aChageColorEn:=False;
aClb:=Abs( Byte(aColor shr 16)- Byte(aMainColor shr 16));
if aClb<=aMainTorl then
begin
// Blue ok
aClg:=Abs( Byte(aColor shr 8)-Byte(aMainColor shr 8));
if aClg <= aMainTorl then
begin
//Green OK
aClr:=Abs( Byte(aColor)-Byte(aMainColor));
if aClr <= aMainTorl then
begin
//Red ok
aChageColorEn:=True;
end;
end;
end;
if aChageColorEn then
bm.Canvas.Pixels[bx,by]:=TColor($FFFFFF); //White
else
bm.Canvas.Pixels[bx,by]:=TColor($000000); //Black
end;
end;
Result:=bm;
end;
//图片反色
procedure TFrmMain.Negative(var Bmp:TBitmap);
var
i, j: Integer;
PRGB: pRGBTriple;
begin
Bmp.PixelFormat:=pf24Bit;
for i := 0 to Bmp.Height - 1 do
begin
PRGB := Bmp.ScanLine[i];
for j := 0 to Bmp.Width - 1 do
begin
PRGB^.rgbtRed :=not PRGB^.rgbtRed ;
PRGB^.rgbtGreen :=not PRGB^.rgbtGreen;
PRGB^.rgbtBlue :=not PRGB^.rgbtBlue;
Inc(PRGB);
end;
end;
end;
以上只做大家的参考
写的不好 别喷我啊
再看 AspriseOCR - OCR应用开发 -20151124的更多相关文章
- 再看Ajax
再回顾Ajax相关的内容,再次梳理学习还是很有必要的,尤其是实际的开发中,ajax更是必不可少,仔细学习以便避免不必要的错误. 文章导读: --1.使用XMLHttpRequest---------- ...
- 我看TDD测试驱动开发
今天在实验室给大家介绍了一下TDD和Docker,大家对TDD都比较感兴趣,包括老板,也问了一些问题. 还是从头来说TDD吧,TDD作为敏捷开发领域的领头军,充满魅力,同时也充满争议.一切从三大军规说 ...
- web前端体系-了解前端,深入前端,架构前端,再看前端。大体系-知识-小细节
1.了解前端,深入前端,架构前端,再看前端.大体系-知识-小细节 个人认为:前端发展最终的导向是前端工程化,智能化,模块化,组件化,层次化. 2.面试第一关:理论知识. 2-1.http标准 2-2. ...
- 记录一次OCR程序开发的尝试
记录一次OCR程序开发的尝试 最近工作中涉及到一部分文档和纸质文档的校验工作,就想把纸质文件拍下来,用文字来互相校验.想到之前调用有道智云接口做了文档翻译.看了下OCR文字识别的API接口,有道提供了 ...
- 再看ftp上传文件
前言 去年在项目中用到ftp上传文件,用FtpWebRequest和FtpWebResponse封装一个帮助类,这个在网上能找到很多,前台使用Uploadify控件,然后在服务器上搭建Ftp服务器,在 ...
- Android菜鸟的成长笔记(17)—— 再看Android中的Unbounded Service
原文:Android菜鸟的成长笔记(17)-- 再看Android中的Unbounded Service 前面已经写过关于startService(Unbounded Service)的一篇文章:&l ...
- 再看case语句
再看case语句,case语句只处理单条记录,而不是set 列名的使用,可以当做数值来使用: case when 后面简直是完美的的,什么东西都是能放的,只要是一个逻辑上的true/false的逻辑就 ...
- android 智能指针的学习先看邓凡平的书扫盲 再看前面两片博客提升
android 智能指针的学习先看邓凡平的书扫盲 再看前面两片博客提升
- python基础----再看property、描述符(__get__,__set__,__delete__)
一.再看property 一个静态属性property ...
随机推荐
- 自适应布局,响应式布局以及rem,em区别
一.自适应和响应式 先说共同点: 两者都是因为越来越多的 移动设备( mobile, tablet device )加入到互联网中来而出现的为移动设备提供更好的体验的技术.用技术来使网页适应从小到大( ...
- 我的第一个GitHub仓库
GitHub 仓库地址 https://github.com/FBean/test.git GitHub 常用命令 add--Add file contents to the index bisect ...
- php部分---文件上传:错误处理、 客户端和服务器端的限制
1.客户端页面 <!---客户端的配置 1.表单页面 2.表单发送方式为post 3.表单form中添加enctype="multipart/form-data" ----- ...
- LeetCode 【347. Top K Frequent Elements】
Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2 ...
- Quartz2D之生成圆形头像、打水印、截图三种方法的封装
我给UIImage类添加了一个类目,用于封装三个方法,每个方法都没有难度,做这个主要为了练习一下封装: 首先在类目.h文件中声明三个方法:以及创建了一个枚举.用于水印方法中设定水印位置:方法说明和参数 ...
- Python + Selenium 实现登录Office 365
最近捡起之前用的Python + Selenium实现工作中需要的登录Office 365功能.(吐槽:国内网络真是卡,登录Office 365实属不易.另外Selenium这样的网站都要墙,无法理解 ...
- (转) Deep Learning Resources
转自:http://www.jeremydjacksonphd.com/category/deep-learning/ Deep Learning Resources Posted on May 13 ...
- Date 对象中的 getYear 和 getFullYear方法
生成一个新的日期对象 : var someDate=new Date(); 获取日期月份中的天数: var date=someDate.getDate(); 获取 4 位数的年份: var year= ...
- Zend Studio 中安装emmet插件的方法
本人的Zend Studio版本是Zend Studio 10.0.0. 1. 打开Zend Studio,点击 Help --> Install New Software,如下图: 2. 在 ...
- CentOS以及Oracle数据库发展历史及各版本新功能介绍, 便于构造环境时有个对应关系
CentOS版本历史 版本 CentOS版本号有两个部分,一个主要版本和一个次要版本,主要和次要版本号分别对应于RHEL的主要版本与更新包,CentOS采取从RHEL的源代码包来构建.例如CentOS ...