日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

再看 AspriseOCR - OCR应用开发

發布時間:2023/12/14 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 再看 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
? ? ? begin
? ? ? ? bm.Canvas.Pixels[bx,by]:=TColor($FFFFFF); ? //White
? ? ? end
? ? ? else
? ? ? begin
? ? ? ? bm.Canvas.Pixels[bx,by]:=TColor($000000); ?//Black
? ? ? end;
? ? 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应用开发的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。