文件名称:delphi ocr图象文字解析
文件大小:211KB
文件格式:RAR
更新时间:2014-12-01 16:06:26
ocr图象文字解析
function identity(libName:pchar;mRound,bone,maxNoise,limit,spn,spx0,spy0,spuw,spuh,sppw,rlL,rlH,ruW,imgW,imgH:Integer;var imgAry:TBArray):string; var ary: TAAIArray; unitAry: TBArray; n,n1,x1,y1,x2,y2,unitW,unitH: Integer; rt: string; begin if spx0 < 0 then spx0 := 0; if spy0 < 0 then spy0 := 0; if spn = 0 then begin if (spx0<>0) or (spy0<>0) or (spuw<>0) or (spuh<>0) then cutArea(imgW,imgH,spx0,spy0,spuw,spuh,imgAry); ary := clearNoise(maxNoise,rlL,rlH,ruW,imgW,imgH,true,imgAry); end else begin n := (imgW-spx0-sppw) div (spuw+sppw) + 1; if (spn = -1) or (spn > n) then spn := n; //针对单元单独去除杂点 SetLength(unitAry,spuw*spuh); for n:=0 to spn-1 do begin for y1:=0 to spuh-1 do for x1:=0 to spuw-1 do unitAry[x1+y1*spuw] := imgAry[(y1+spy0)*imgW+x1+n*(spuw+sppw)+spx0]; clearNoise(maxNoise,1,1,spuw,spuw,spuh,false,unitAry); for y1:=0 to spuh-1 do for x1:=0 to spuw-1 do imgAry[(y1+spy0)*imgW+x1+n*(spuw+sppw)+spx0] := unitAry[x1+y1*spuw]; end; ary := splitArea(spn,spx0,spy0,spuw,spuh,sppw,imgW,imgAry); end; if Length(ary) = 0 then rt := '?' else rt := ''; for n:=0 to Length(ary)-1 do begin if Length(ary[n]) = 0 then continue; x1 := ary[n][0][0]; y1 := ary[n][0][1]; x2 := x1; y2 := y1; for n1:=1 to Length(ary[n])-1 do begin if ary[n][n1][0] < x1 then x1 := ary[n][n1][0]; if ary[n][n1][0] > x2 then x2 := ary[n][n1][0]; if ary[n][n1][1] < y1 then y1 := ary[n][n1][1]; if ary[n][n1][1] > y2 then y2 := ary[n][n1][1]; end; unitW := x2 - x1 + 1; unitH := y2 - y1 + 1; SetLength(unitAry,unitW*unitH); for n1:=0 to Length(unitAry)-1 do unitAry[n1] := 0; for n1:=0 to Length(ary[n])-1 do unitAry[(ary[n][n1][1]-y1)*unitW+ary[n][n1][0]-x1] := 1; rt := rt + unitIdentity(libName,mRound,bone,limit,unitW,unitH,unitAry); end; result := rt; end;
【文件预览】:
识别程序
----func.pas(22KB)
----Project1.exe(191KB)
----Project1.res(876B)
----img()
--------3.bmp(7KB)
--------1.bmp(5KB)
--------4.bmp(7KB)
--------2.bmp(7KB)
--------5.bmp(7KB)
----code.lib(5KB)
----Unit1.dfm(943B)
----Unit1.ddp(51B)
----Project1.cfg(434B)
----kind1.pas(6KB)
----Unit1.pas(1KB)
----NdOcr.pas(5KB)
----Project1.dpr(188B)
----Project1.dof(2KB)
----comm.pas(922B)