diff --git a/LibDataBase/LibDataBase.csproj b/LibDataBase/LibDataBase.csproj
new file mode 100644
index 0000000..48f6df9
--- /dev/null
+++ b/LibDataBase/LibDataBase.csproj
@@ -0,0 +1,68 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {D03A85CC-A53B-4434-A560-7A89563292E8}
+ Library
+ Properties
+ LibDataBase
+ LibDataBase
+ v4.7.2
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+ true
+ bin\x64\Debug\
+ DEBUG;TRACE
+ full
+ x64
+ 7.3
+ prompt
+
+
+ bin\x64\Release\
+ TRACE
+ true
+ pdbonly
+ x64
+ 7.3
+ prompt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TetraPackOCR/OCRTextResult.cs b/LibDataBase/OCRTextResult.cs
similarity index 83%
rename from TetraPackOCR/OCRTextResult.cs
rename to LibDataBase/OCRTextResult.cs
index 3426a2f..8599af0 100644
--- a/TetraPackOCR/OCRTextResult.cs
+++ b/LibDataBase/OCRTextResult.cs
@@ -5,9 +5,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace TetraPackOCR
+namespace LibDataBase
{
- internal class OCRTextResult
+ public class OCRTextResult
{
public bool match;
public string text;
diff --git a/LibDataBase/Properties/AssemblyInfo.cs b/LibDataBase/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..8eb0957
--- /dev/null
+++ b/LibDataBase/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("LibDataBase")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("HP")]
+[assembly: AssemblyProduct("LibDataBase")]
+[assembly: AssemblyCopyright("Copyright © HP 2025")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("d03a85cc-a53b-4434-a560-7a89563292e8")]
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/TetraPackOCR/HPoint.cs b/LibDataBase/TextPoint.cs
similarity index 74%
rename from TetraPackOCR/HPoint.cs
rename to LibDataBase/TextPoint.cs
index 70b20b9..ea6d247 100644
--- a/TetraPackOCR/HPoint.cs
+++ b/LibDataBase/TextPoint.cs
@@ -1,24 +1,21 @@
using System;
using System.Collections.Generic;
-namespace TetraPackOCR
+namespace LibDataBase
{
///
/// 点
///
- class Point
+ public class TextPoint
{
public int x;
public int y;
public string txt;
- public Point(int x, int y,string txt)
+ public TextPoint(int x, int y,string txt)
{
this.x = x;
this.y = y;
this.txt = txt;
}
}
-
-
-
}
diff --git a/LibReadTetraExcel/LibReadTetraExcel.csproj b/LibReadTetraExcel/LibReadTetraExcel.csproj
index 15eda37..186cfbb 100644
--- a/LibReadTetraExcel/LibReadTetraExcel.csproj
+++ b/LibReadTetraExcel/LibReadTetraExcel.csproj
@@ -62,5 +62,11 @@
+
+
+ {d03a85cc-a53b-4434-a560-7a89563292e8}
+ LibDataBase
+
+
\ No newline at end of file
diff --git a/TetraPackOCR/Form1.cs b/TetraPackOCR/Form1.cs
index c02b715..5313ef2 100644
--- a/TetraPackOCR/Form1.cs
+++ b/TetraPackOCR/Form1.cs
@@ -38,6 +38,7 @@ using System.Threading.Tasks;
using System.Windows.Documents;
using System.Windows.Forms;
using ThridLibray;
+using LibDataBase;
namespace TetraPackOCR
{
@@ -1230,14 +1231,14 @@ namespace TetraPackOCR
#endregion
#region 排序算法
- List paixu(List points)
+ List paixu(List points)
{
int rowDistance = 50;
- List> rows = new List>();
+ List> rows = new List>();
for (int i = 0; i < points.Count; i++)
{
- List row = new List();
+ List row = new List();
row.Add(points[i]);
for (int j = i + 1; j < points.Count; j++)
@@ -1250,12 +1251,12 @@ namespace TetraPackOCR
rows.Add(row);
}
- List sortedPoints = new List();
+ List sortedPoints = new List();
- foreach (List row in rows)
+ foreach (List row in rows)
{
row.Sort((x, y) => x.x - y.x);
- foreach (Point point in row)
+ foreach (TextPoint point in row)
{
if (!sortedPoints.Contains(point))
{
@@ -1460,18 +1461,18 @@ namespace TetraPackOCR
OCRTextResult result = new OCRTextResult();
List lastocr = new List();
OCRResult ocrResult = Engine.DetectText(ocrimagebyte);
- List pointsList = new List();
+ List pointsList = new List();
foreach (var item in ocrResult.TextBlocks)
{
if (item.Text.Contains(ocrTextDesign[mMatchingStr]))
{
result.points.Add(item.BoxPoints.Select(x => new PointF() { X = x.X, Y = x.Y }).ToArray());
- pointsList.Add(new Point(item.BoxPoints[0].X, item.BoxPoints[0].Y, item.Text));
+ pointsList.Add(new TextPoint(item.BoxPoints[0].X, item.BoxPoints[0].Y, item.Text));
}
}
- List paixujeguo = paixu(pointsList);
+ List paixujeguo = paixu(pointsList);
foreach (var it in paixujeguo)
{
lastocr.Add(it.txt);
diff --git a/TetraPackOCR/TetraPackOCR.csproj b/TetraPackOCR/TetraPackOCR.csproj
index 0f72c79..632ab97 100644
--- a/TetraPackOCR/TetraPackOCR.csproj
+++ b/TetraPackOCR/TetraPackOCR.csproj
@@ -276,8 +276,6 @@
Form1.cs
-
-
@@ -327,6 +325,16 @@
+
+
+ {d03a85cc-a53b-4434-a560-7a89563292e8}
+ LibDataBase
+
+
+ {b88b2fa9-0d9d-4ebb-a87a-4de2dc2dd70f}
+ LibReadTetraExcel
+
+
diff --git a/TetraPark.OCR.sln b/TetraPark.OCR.sln
index 92114a5..5c95b1c 100644
--- a/TetraPark.OCR.sln
+++ b/TetraPark.OCR.sln
@@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dll", "Dll", "{C0079401-F42
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibReadTetraExcel", "LibReadTetraExcel\LibReadTetraExcel.csproj", "{B88B2FA9-0D9D-4EBB-A87A-4DE2DC2DD70F}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibDataBase", "LibDataBase\LibDataBase.csproj", "{D03A85CC-A53B-4434-A560-7A89563292E8}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -43,12 +45,21 @@ Global
{B88B2FA9-0D9D-4EBB-A87A-4DE2DC2DD70F}.Release|Any CPU.Build.0 = Release|Any CPU
{B88B2FA9-0D9D-4EBB-A87A-4DE2DC2DD70F}.Release|x64.ActiveCfg = Release|Any CPU
{B88B2FA9-0D9D-4EBB-A87A-4DE2DC2DD70F}.Release|x64.Build.0 = Release|Any CPU
+ {D03A85CC-A53B-4434-A560-7A89563292E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D03A85CC-A53B-4434-A560-7A89563292E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D03A85CC-A53B-4434-A560-7A89563292E8}.Debug|x64.ActiveCfg = Debug|x64
+ {D03A85CC-A53B-4434-A560-7A89563292E8}.Debug|x64.Build.0 = Debug|x64
+ {D03A85CC-A53B-4434-A560-7A89563292E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D03A85CC-A53B-4434-A560-7A89563292E8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D03A85CC-A53B-4434-A560-7A89563292E8}.Release|x64.ActiveCfg = Release|Any CPU
+ {D03A85CC-A53B-4434-A560-7A89563292E8}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B88B2FA9-0D9D-4EBB-A87A-4DE2DC2DD70F} = {C0079401-F420-4256-B991-3BF16D3296C7}
+ {D03A85CC-A53B-4434-A560-7A89563292E8} = {C0079401-F420-4256-B991-3BF16D3296C7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F550CA1D-FC09-446C-B501-170B642AAC00}