设为首页 加入收藏

TOP

再看 AspriseOCR - OCR应用开发 -20151124(一)
2017-10-10 12:06:53 】 浏览:8974
Tags:再看 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
&n

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Delphi 取得 iOS 辅助使用里的字.. 下一篇进货单条码打印

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目