Add LibDataBase
This commit is contained in:
68
LibDataBase/LibDataBase.csproj
Normal file
68
LibDataBase/LibDataBase.csproj
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{D03A85CC-A53B-4434-A560-7A89563292E8}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>LibDataBase</RootNamespace>
|
||||||
|
<AssemblyName>LibDataBase</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<LangVersion>7.3</LangVersion>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
|
<OutputPath>bin\x64\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<LangVersion>7.3</LangVersion>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="TextPoint.cs" />
|
||||||
|
<Compile Include="OCRTextResult.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
@@ -5,9 +5,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace TetraPackOCR
|
namespace LibDataBase
|
||||||
{
|
{
|
||||||
internal class OCRTextResult
|
public class OCRTextResult
|
||||||
{
|
{
|
||||||
public bool match;
|
public bool match;
|
||||||
public string text;
|
public string text;
|
||||||
33
LibDataBase/Properties/AssemblyInfo.cs
Normal file
33
LibDataBase/Properties/AssemblyInfo.cs
Normal file
@@ -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")]
|
||||||
@@ -1,24 +1,21 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace TetraPackOCR
|
namespace LibDataBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 点
|
/// 点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class Point
|
public class TextPoint
|
||||||
{
|
{
|
||||||
public int x;
|
public int x;
|
||||||
public int y;
|
public int y;
|
||||||
public string txt;
|
public string txt;
|
||||||
public Point(int x, int y,string txt)
|
public TextPoint(int x, int y,string txt)
|
||||||
{
|
{
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.txt = txt;
|
this.txt = txt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -62,5 +62,11 @@
|
|||||||
<Compile Include="Class1.cs" />
|
<Compile Include="Class1.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\LibDataBase\LibDataBase.csproj">
|
||||||
|
<Project>{d03a85cc-a53b-4434-a560-7a89563292e8}</Project>
|
||||||
|
<Name>LibDataBase</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -38,6 +38,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ThridLibray;
|
using ThridLibray;
|
||||||
|
using LibDataBase;
|
||||||
|
|
||||||
namespace TetraPackOCR
|
namespace TetraPackOCR
|
||||||
{
|
{
|
||||||
@@ -1230,14 +1231,14 @@ namespace TetraPackOCR
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 排序算法
|
#region 排序算法
|
||||||
List<Point> paixu(List<Point> points)
|
List<TextPoint> paixu(List<TextPoint> points)
|
||||||
{
|
{
|
||||||
int rowDistance = 50;
|
int rowDistance = 50;
|
||||||
List<List<Point>> rows = new List<List<Point>>();
|
List<List<TextPoint>> rows = new List<List<TextPoint>>();
|
||||||
|
|
||||||
for (int i = 0; i < points.Count; i++)
|
for (int i = 0; i < points.Count; i++)
|
||||||
{
|
{
|
||||||
List<Point> row = new List<Point>();
|
List<TextPoint> row = new List<TextPoint>();
|
||||||
row.Add(points[i]);
|
row.Add(points[i]);
|
||||||
|
|
||||||
for (int j = i + 1; j < points.Count; j++)
|
for (int j = i + 1; j < points.Count; j++)
|
||||||
@@ -1250,12 +1251,12 @@ namespace TetraPackOCR
|
|||||||
rows.Add(row);
|
rows.Add(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Point> sortedPoints = new List<Point>();
|
List<TextPoint> sortedPoints = new List<TextPoint>();
|
||||||
|
|
||||||
foreach (List<Point> row in rows)
|
foreach (List<TextPoint> row in rows)
|
||||||
{
|
{
|
||||||
row.Sort((x, y) => x.x - y.x);
|
row.Sort((x, y) => x.x - y.x);
|
||||||
foreach (Point point in row)
|
foreach (TextPoint point in row)
|
||||||
{
|
{
|
||||||
if (!sortedPoints.Contains(point))
|
if (!sortedPoints.Contains(point))
|
||||||
{
|
{
|
||||||
@@ -1460,18 +1461,18 @@ namespace TetraPackOCR
|
|||||||
OCRTextResult result = new OCRTextResult();
|
OCRTextResult result = new OCRTextResult();
|
||||||
List<string> lastocr = new List<string>();
|
List<string> lastocr = new List<string>();
|
||||||
OCRResult ocrResult = Engine.DetectText(ocrimagebyte);
|
OCRResult ocrResult = Engine.DetectText(ocrimagebyte);
|
||||||
List<Point> pointsList = new List<Point>();
|
List<TextPoint> pointsList = new List<TextPoint>();
|
||||||
|
|
||||||
foreach (var item in ocrResult.TextBlocks)
|
foreach (var item in ocrResult.TextBlocks)
|
||||||
{
|
{
|
||||||
if (item.Text.Contains(ocrTextDesign[mMatchingStr]))
|
if (item.Text.Contains(ocrTextDesign[mMatchingStr]))
|
||||||
{
|
{
|
||||||
result.points.Add(item.BoxPoints.Select(x => new PointF() { X = x.X, Y = x.Y }).ToArray());
|
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<Point> paixujeguo = paixu(pointsList);
|
List<TextPoint> paixujeguo = paixu(pointsList);
|
||||||
foreach (var it in paixujeguo)
|
foreach (var it in paixujeguo)
|
||||||
{
|
{
|
||||||
lastocr.Add(it.txt);
|
lastocr.Add(it.txt);
|
||||||
|
|||||||
@@ -276,8 +276,6 @@
|
|||||||
<Compile Include="Form1.Designer.cs">
|
<Compile Include="Form1.Designer.cs">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="HPoint.cs" />
|
|
||||||
<Compile Include="OCRTextResult.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<EmbeddedResource Include="Form1.resx">
|
<EmbeddedResource Include="Form1.resx">
|
||||||
@@ -327,6 +325,16 @@
|
|||||||
<None Include="Resources\ON.png" />
|
<None Include="Resources\ON.png" />
|
||||||
<None Include="Resources\OFF.png" />
|
<None Include="Resources\OFF.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\LibDataBase\LibDataBase.csproj">
|
||||||
|
<Project>{d03a85cc-a53b-4434-a560-7a89563292e8}</Project>
|
||||||
|
<Name>LibDataBase</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\LibReadTetraExcel\LibReadTetraExcel.csproj">
|
||||||
|
<Project>{b88b2fa9-0d9d-4ebb-a87a-4de2dc2dd70f}</Project>
|
||||||
|
<Name>LibReadTetraExcel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dll", "Dll", "{C0079401-F42
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibReadTetraExcel", "LibReadTetraExcel\LibReadTetraExcel.csproj", "{B88B2FA9-0D9D-4EBB-A87A-4DE2DC2DD70F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibReadTetraExcel", "LibReadTetraExcel\LibReadTetraExcel.csproj", "{B88B2FA9-0D9D-4EBB-A87A-4DE2DC2DD70F}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibDataBase", "LibDataBase\LibDataBase.csproj", "{D03A85CC-A53B-4434-A560-7A89563292E8}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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|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.ActiveCfg = Release|Any CPU
|
||||||
{B88B2FA9-0D9D-4EBB-A87A-4DE2DC2DD70F}.Release|x64.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{B88B2FA9-0D9D-4EBB-A87A-4DE2DC2DD70F} = {C0079401-F420-4256-B991-3BF16D3296C7}
|
{B88B2FA9-0D9D-4EBB-A87A-4DE2DC2DD70F} = {C0079401-F420-4256-B991-3BF16D3296C7}
|
||||||
|
{D03A85CC-A53B-4434-A560-7A89563292E8} = {C0079401-F420-4256-B991-3BF16D3296C7}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {F550CA1D-FC09-446C-B501-170B642AAC00}
|
SolutionGuid = {F550CA1D-FC09-446C-B501-170B642AAC00}
|
||||||
|
|||||||
Reference in New Issue
Block a user