unit bmp2number;
{将传递进来的图像进行对比,识别出图片中的数字。
本程序使用的是模式识别的方式,需要照片标准,数字无反光。
电表只有4位数字+1位小数,小数因为在拍照中不能保证停止,所以本程序也不作小数位的识别
因此。如果当前的数字 已经识别到了4位,程序就返回,
我们预设一个记录,用来记录这被识别的出4位数字的具体位置,再通过对TOP及LEFT位置的进行排序组合后返回
对于本模板的重要方法说明:
Function GetNumber:string
功能:返回识别出的数字字符串
按照对TBmp2Number对象的下列属性:
SoruceBitmap:需要被识别的图像
Temp_Index:模板编号
Temp_path:模板文件目录
discern_rate:识别率
}
interface
uses windows,math,classes,controls,graphics,jpeg,sysutils,dialogs,extctrls,forms,
stdctrls,ComCtrls;
Type
pRGBTripleArray = ^TRGBTripleArray;
TRGBTripleArray = array [0 .. 65535] of TRGBTriple;
Ptemplate=^Ttemplate; //被识别的数字当用记录保存起来
Ttemplate=record
number:integer;
top:Integer;
Left:Integer;
end;
TBmp2Number=class(Tobject)
private
FSourceBitMap:Tbitmap;
FTempl_index:integer;
Ftempl_Path:String;
Fdiscern_rate:Double;
FNumber:string;
FNumberList:TList;
tmeplate:Ptemplate;
fStop:Boolean;
FShowDemo:Boolean;
protected
procedure SetTempl_index(value:Integer);
procedure SetTempl_path(Value:String);
procedure InitTemplate;
Function GetNumber:String;
public
memo1:TRichedit;
image1,image2:Timage;
pb_Count,pb_deta:TProgressbar;
constructor Create;
published
property SourceBitMap:Tbitmap read FSourceBitMap write FSourceBitmap;
property Templ_index:integer read Ftempl_index write SetTempl_index;
Property Templ_Path:String read Ftempl_Path write SetTempl_path;
property discern_rate:Double read Fdiscern_rate write Fdiscern_ra
{将传递进来的图像进行对比,识别出图片中的数字。
本程序使用的是模式识别的方式,需要照片标准,数字无反光。
电表只有4位数字+1位小数,小数因为在拍照中不能保证停止,所以本程序也不作小数位的识别
因此。如果当前的数字 已经识别到了4位,程序就返回,
我们预设一个记录,用来记录这被识别的出4位数字的具体位置,再通过对TOP及LEFT位置的进行排序组合后返回
对于本模板的重要方法说明:
Function GetNumber:string
功能:返回识别出的数字字符串
按照对TBmp2Number对象的下列属性:
SoruceBitmap:需要被识别的图像
Temp_Index:模板编号
Temp_path:模板文件目录
discern_rate:识别率
}
interface
uses windows,math,classes,controls,graphics,jpeg,sysutils,dialogs,extctrls,forms,
stdctrls,ComCtrls;
Type
pRGBTripleArray = ^TRGBTripleArray;
TRGBTripleArray = array [0 .. 65535] of TRGBTriple;
Ptemplate=^Ttemplate; //被识别的数字当用记录保存起来
Ttemplate=record
number:integer;
top:Integer;
Left:Integer;
end;
TBmp2Number=class(Tobject)
private
FSourceBitMap:Tbitmap;
FTempl_index:integer;
Ftempl_Path:String;
Fdiscern_rate:Double;
FNumber:string;
FNumberList:TList;
tmeplate:Ptemplate;
fStop:Boolean;
FShowDemo:Boolean;
protected
procedure SetTempl_index(value:Integer);
procedure SetTempl_path(Value:String);
procedure InitTemplate;
Function GetNumber:String;
public
memo1:TRichedit;
image1,image2:Timage;
pb_Count,pb_deta:TProgressbar;
constructor Create;
published
property SourceBitMap:Tbitmap read FSourceBitMap write FSourceBitmap;
property Templ_index:integer read Ftempl_index write SetTempl_index;
Property Templ_Path:String read Ftempl_Path write SetTempl_path;
property discern_rate:Double read Fdiscern_rate write Fdiscern_ra