车牌识别的模块已经封装成了dll(c++),
用delphi做二次开发,把指定文件夹内的图片名存在一个数组里,
然后用循环识别每一张图片,但是循环的太快了,界面上的文本框的信息一直是空白的,
最后一张才显示。
procedure TForm1.Timer1Timer(Sender: TObject);
var
AllTrust: string;
indexPic: integer;
FindData: TWin32FindData;
Handle1: THandle;
FileNameList: TstringList;
begin
timer1.Enabled := false; //停止计时
begin
begin
FileNameList := TStringList.create;
Handle1 := FindFirstFile(PChar('d:\img\*.jpg'), FindData);
if (Handle1 <> INVALID_HANDLE_VALUE) then
begin
repeat
if (FindData.dwFileAttributes and (FILE_ATTRIBUTE_DIRECTORY) = 0) then
begin
FileNameList.add(FindData.cFileName); //文件名
end;
until FindNextFile(Handle1, FindData) <> True;
Windows.FindClose(Handle1);
end; for indexPic := 0 to FileNameList.Count - 1 do
//识别开始
ISPICREC1.Load('d:\img\' + FileNameList[indexPic]);//载入图片 if (ISPICREC1.Recognize(0)) then //识别成功
begin
Edit2.Text := ISPICREC1.Plate; //车牌号码
Edit3.Text := ISPICREC1.PlateColor; //车牌颜色
Edit5.Text := inttostr(ISPICREC1.PlateTop); //车牌图片位于图片的上下左右的
Edit6.Text := inttostr(ISPICREC1.PlateBottom); //坐标
Edit7.Text := inttostr(ISPICREC1.PlateLeft);
Edit8.Text := inttostr(ISPICREC1.PlateRight);
//Sleep(1000);
end
else
begin
Edit2.Text := '识别失败' + FormatdateTime('zzz',now);
Sleep(2000);
end;
end; end;
FileNameList.free;
timer1.Enabled := true; //开始计时
end;QQ 1721陆陆566因为长期是做其他的开发,delphi基本没用过,还请各位帮忙谢谢
用delphi做二次开发,把指定文件夹内的图片名存在一个数组里,
然后用循环识别每一张图片,但是循环的太快了,界面上的文本框的信息一直是空白的,
最后一张才显示。
procedure TForm1.Timer1Timer(Sender: TObject);
var
AllTrust: string;
indexPic: integer;
FindData: TWin32FindData;
Handle1: THandle;
FileNameList: TstringList;
begin
timer1.Enabled := false; //停止计时
begin
begin
FileNameList := TStringList.create;
Handle1 := FindFirstFile(PChar('d:\img\*.jpg'), FindData);
if (Handle1 <> INVALID_HANDLE_VALUE) then
begin
repeat
if (FindData.dwFileAttributes and (FILE_ATTRIBUTE_DIRECTORY) = 0) then
begin
FileNameList.add(FindData.cFileName); //文件名
end;
until FindNextFile(Handle1, FindData) <> True;
Windows.FindClose(Handle1);
end; for indexPic := 0 to FileNameList.Count - 1 do
//识别开始
ISPICREC1.Load('d:\img\' + FileNameList[indexPic]);//载入图片 if (ISPICREC1.Recognize(0)) then //识别成功
begin
Edit2.Text := ISPICREC1.Plate; //车牌号码
Edit3.Text := ISPICREC1.PlateColor; //车牌颜色
Edit5.Text := inttostr(ISPICREC1.PlateTop); //车牌图片位于图片的上下左右的
Edit6.Text := inttostr(ISPICREC1.PlateBottom); //坐标
Edit7.Text := inttostr(ISPICREC1.PlateLeft);
Edit8.Text := inttostr(ISPICREC1.PlateRight);
//Sleep(1000);
end
else
begin
Edit2.Text := '识别失败' + FormatdateTime('zzz',now);
Sleep(2000);
end;
end; end;
FileNameList.free;
timer1.Enabled := true; //开始计时
end;QQ 1721陆陆566因为长期是做其他的开发,delphi基本没用过,还请各位帮忙谢谢
begin
//识别开始
ISPICREC1.Load('d:\img\' + FileNameList[indexPic]);//载入图片 if (ISPICREC1.Recognize(0)) then //识别成功
begin
Edit2.Text := ISPICREC1.Plate; //车牌号码
Edit3.Text := ISPICREC1.PlateColor; //车牌颜色
Edit5.Text := inttostr(ISPICREC1.PlateTop); //车牌图片位于图片的上下左右的
Edit6.Text := inttostr(ISPICREC1.PlateBottom); //坐标
Edit7.Text := inttostr(ISPICREC1.PlateLeft);
Edit8.Text := inttostr(ISPICREC1.PlateRight);
//Sleep(1000);
end
else
begin
Edit2.Text := '识别失败' + FormatdateTime('zzz',now);
Sleep(2000);
end;
end;
注释代码打开,并加大为Sleep(3000); 试试能不能看出效果
var
i: Integer;
begin
for i := 1 to 4 do
begin
Edit1.Color := clRed;
Edit1.Text := IntTOStr(I);
Application.ProcessMessages;
sleep(1000);
end;
end;
难道我rpwt?