From 0756bf12d10cf1b7f78c571de0a9ad69cbaeb7ca Mon Sep 17 00:00:00 2001
From: curtis <curtis@i-mps.com>
Date: 星期一, 30 三月 2026 14:24:17 +0800
Subject: [PATCH] fix: 更新內部引用方法參照
---
reassemble/img/anchor.pas | 68 ++++++++++++++++++++++++++++++++++
1 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/reassemble/img/anchor.pas b/reassemble/img/anchor.pas
new file mode 100644
index 0000000..3a5fcb3
--- /dev/null
+++ b/reassemble/img/anchor.pas
@@ -0,0 +1,68 @@
+{ ==============================================================================
+ 方法名稱:GetSiteOMR
+ 引用相依:GetSiteOMR, FindPoint, 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;
+
+
--
Gitblit v1.8.0