| | |
| | | { ============================================================================== |
| | | 方法名稱:GetSiteOMR |
| | | 引用相依:FindPoint, GetSiteOMR, Get_OMR, LoadFromFile |
| | | 方法描述:在指定影像文件的特定座標執行 OMR (光學標記辨識)。核心邏輯包含: |
| | | 1. 檢查並載入影像檔(若尚未載入),並呼叫 ClearLine 初始化黑白緩衝區。 |
| | | 2. 讀取影像的 DPI 與寬高資訊。 |
| | | 3. 使用 CM_Str2Rect 將 Site 字串轉為 TRect 矩陣,並參考定位點 (UpLPoi |
| | | nt) 進行位移計算。 |
| | | 4. 限制辨識區域座標不超出影像邊界。 |
| | | 5. 呼叫 Get_OMR 對黑白圖形緩衝區執行辨識並返回結果值(通常為 1 或 0)。 |
| | | 此方法是自動化資料檢核的重要工具。 |
| | | ============================================================================== } |
| | | function TCB_IMGPSScanX.GetSiteOMR(FileName,Site:String;bt: Integer): Integer; |
| | | var |
| | | OMRRect : TRect; |
| | | Xdpi,Ydpi : Integer; |
| | | W,H : Integer; |
| | | begin |
| | | Result := 0; |
| | | //ShowMessage('GetSiteOMR'); |
| | | |
| | | IF (ImageScrollBox1.FileName <> FileName) and (FileName <> '') then |
| | | begin |
| | | //ShowMessage('11111'+ImageScrollBox1.FileName+#10#13+FileName); |
| | | ImageScrollBox1.LoadFromFile(FileName,1); |
| | | { |
| | | ShowMessage('UpLPoint='+IntToStr(UpLPoint.X)+','+IntToStr(UpLPoint.Y)+#10#13+ |
| | | 'UpRPoint='+IntToStr(UpRPoint.X)+','+IntToStr(UpRPoint.Y)+#10#13+ |
| | | 'DownLPoint='+IntToStr(DownLPoint.X)+','+IntToStr(DownLPoint.Y)+#10#13+ |
| | | 'DownRPoint='+IntToStr(DownRPoint.X)+','+IntToStr(DownRPoint.Y)); |
| | | FindPoint(ImageScrollBox1.Graphic,UpLPoint,UpRPoint,DownLPoint,''); |
| | | ShowMessage('UpLPoint='+IntToStr(UpLPoint.X)+','+IntToStr(UpLPoint.Y)+#10#13+ |
| | | 'UpRPoint='+IntToStr(UpRPoint.X)+','+IntToStr(UpRPoint.Y)+#10#13+ |
| | | 'DownLPoint='+IntToStr(DownLPoint.X)+','+IntToStr(DownLPoint.Y)+#10#13+ |
| | | 'DownRPoint='+IntToStr(DownRPoint.X)+','+IntToStr(DownRPoint.Y)); |
| | | } |
| | | ClearLine(ISB_BW.Graphic,bt); |
| | | ISB_BW.Redraw(True); |
| | | Application.ProcessMessages; |
| | | end; |
| | | If ImageScrollBox1.FileName <> '' Then |
| | | begin |
| | | |
| | | //ShowMessage('22222'+ImageScrollBox1.FileName); |
| | | Xdpi := ImagescrollBox1.Graphic.XDotsPerInch; |
| | | Ydpi := ImagescrollBox1.Graphic.YDotsPerInch; |
| | | H := ImageScrollBox1.Graphic.Height; |
| | | W := ImageScrollBox1.Graphic.Width; |
| | | //ShowMessage('Xdpi='+IntToStr(Xdpi)+#10#13+'Ydpi='+IntToStr(Ydpi)+#10#13+'H='+IntToStr(H)+#10#13+'W='+IntToStr(W)+#10#13); |
| | | //ShowMessage('Site='+Site); |
| | | OMRRect := CM_Str2Rect(Site,Xdpi,UpLPoint); |
| | | Display1.Lines.Add('UpLPoint=('+IntToStr(UpLPoint.X)+','+IntToStr(UpLPoint.Y)+');'+Site+';'+IntToStr(OMRRect.Left)+','+IntToStr(OMRRect.top)+','+IntToStr(OMRRect.Right)+','+IntToStr(OMRRect.Bottom)); |
| | | if OMRRect.Left < 0 then |
| | | OMRRect.Left := 0; |
| | | if OMRRect.Top < 0 then |
| | | OMRRect.Top := 0; |
| | | if OMRRect.Right > ImageScrollBox1.Graphic.Width then |
| | | OMRRect.Right := ImageScrollBox1.Graphic.Width; |
| | | if OMRRect.Bottom > ImageScrollBox1.Graphic.Height then |
| | | OMRRect.Bottom := ImageScrollBox1.Graphic.Height; |
| | | |
| | | result := Get_OMR(ISB_BW.Graphic,OMRRect); |
| | | //ShowMessage('result='+IntToStr(result)); |
| | | |
| | | end; |
| | | end; |
| | | |
| | | |
| | | { ============================================================================== |
| | | 方法名稱:CheckRule2OMRErrInfo |
| | | 引用相依: |
| | | 方法描述:將檢核規則清單(CHECK_RULE_INF_List)中的資料轉換為內部的 OMRErrInfo R |
| | |
| | | |
| | | { ============================================================================== |
| | | 方法名稱:DistinctFormCode |
| | | 引用相依:LoadFromFile, LoadFileGetMD5 |
| | | 引用相依:LoadFileGetMD5, LoadFromFile |
| | | 方法描述:從案件的 Context.dat 檔案中提取不重複的表單代碼(FormCode)並存入 OMRF |
| | | ileList。程序會遍歷上傳目錄下的所有檔案,檢查檔案是否存在且未被處理過。 |
| | | 接著比對 OMRFileList 中已有的表單代碼,若為新出現的表單代碼且檔案有效 |
| | |
| | | |
| | | { ============================================================================== |
| | | 方法名稱:OMRCheckCase |
| | | 引用相依:ImageReSize_FormID, GetSiteOMR, FindPoint, LoadFromFile, FileExists, |
| | | SaveToFile |
| | | 引用相依:FileExists, FindPoint, GetSiteOMR, ImageReSize_FormID, ImageResize, |
| | | LoadFromFile, SaveToFile |
| | | 方法描述:執行案件的自動化 OMR 規則檢核,這是確保掃瞄案件合規性的核心邏輯。程序 |
| | | 流程: |
| | | 1. 初始化檢核日誌。 |