车牌识别的模块已经封装成了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基本没用过,还请各位帮忙谢谢

解决方案 »

  1.   

         for indexPic := 0 to FileNameList.Count - 1 do
         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;
      

  2.   

    似乎少了begin ... end(如上)
      

  3.   

    把  //Sleep(1000); 
    注释代码打开,并加大为Sleep(3000); 试试能不能看出效果
      

  4.   

    sleep延时之前加上这句Application.ProcessMessages;
      

  5.   

    泪奔 不的行 好像sleep就没起作用
      

  6.   

    不可能吧,你那个原来应该和我下面的代码是一样,我试了可以啊procedure TForm1.Button1Click(Sender: TObject);
    var
      i: Integer;
    begin
      for i := 1 to 4 do
      begin
        Edit1.Color := clRed;
        Edit1.Text := IntTOStr(I);
        Application.ProcessMessages;
        sleep(1000);
      end;
    end;
      

  7.   

    我这里有和timer
    难道我rpwt?
      

  8.   

    将timer1.Enabled := false; //停止计时  放在 循环结束去掉:timer1.Enabled := true; //开始计时 
      

  9.   

    找到原因了 又少了一个begin end
      

  10.   

    一旦开始识别,关都关不掉 确信不是dll的问题