Commit d888db92 张东亮

ocr整张图识别

1 个父辈 9d168cb9
...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
<Compile Include="MaterialEdit.cs" /> <Compile Include="MaterialEdit.cs" />
<Compile Include="PrintLabelShow.cs" /> <Compile Include="PrintLabelShow.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Setting_Str.cs" />
<Compile Include="TextBlock.cs" /> <Compile Include="TextBlock.cs" />
<Compile Include="UsersLogin.cs" /> <Compile Include="UsersLogin.cs" />
</ItemGroup> </ItemGroup>
......
...@@ -163,15 +163,6 @@ namespace BLL ...@@ -163,15 +163,6 @@ namespace BLL
} }
/// <summary> /// <summary>
/// 启用OCR识别
/// </summary>
public bool EnabledOCR
{
get => config.Read(ENABLED_OCR, true);
set => config.Write(ENABLED_OCR, value);
}
/// <summary>
/// IO模块IP地址 /// IO模块IP地址
/// </summary> /// </summary>
public string IOIPAddress public string IOIPAddress
...@@ -332,7 +323,8 @@ namespace BLL ...@@ -332,7 +323,8 @@ namespace BLL
public static MyConfig<string> DataSource_DataTitle; public static MyConfig<string> DataSource_DataTitle;
[MyConfigComment("遍历数据源目录")] [MyConfigComment("遍历数据源目录")]
public static MyConfig<bool> DataSource_Recursive; public static MyConfig<bool> DataSource_Recursive;
[MyConfigComment("是否启用OCR")]
public static MyConfig<bool> Func_EnabledOCR;
public void Save() public void Save()
...@@ -365,7 +357,6 @@ namespace BLL ...@@ -365,7 +357,6 @@ namespace BLL
private const string PROMPT_AFTER_PRINTING = "PromptAfterPrinting"; private const string PROMPT_AFTER_PRINTING = "PromptAfterPrinting";
private const string ENABLED_IO = "EnabledIO"; private const string ENABLED_IO = "EnabledIO";
private const string ENABLED_CAMERA = "EnabledCamera"; private const string ENABLED_CAMERA = "EnabledCamera";
private const string ENABLED_OCR = "EnabledOCR";
private const string IO_IP = "IOIP"; private const string IO_IP = "IOIP";
private const string IO_TOUCH = "IOTouch"; private const string IO_TOUCH = "IOTouch";
private const string IO_LIGHT = "IOLight"; private const string IO_LIGHT = "IOLight";
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Reflection.Emit;
using System.Xml; using System.Xml;
using CameraVisionLib.Model; using CameraVisionLib.Model;
using DocumentFormat.OpenXml.Drawing; using DocumentFormat.OpenXml.Drawing;
...@@ -20,7 +21,6 @@ namespace BLL ...@@ -20,7 +21,6 @@ namespace BLL
public NamedPipeClient namedPipeClient = new NamedPipeClient("OcrService", "."); public NamedPipeClient namedPipeClient = new NamedPipeClient("OcrService", ".");
public MaterialEdit() public MaterialEdit()
{ {
LogNet.log.Info("读取物料模板");
List<string> xmlFile = new(); List<string> xmlFile = new();
List<string> jpgFile = new(); List<string> jpgFile = new();
string[] allFiles = System.IO.Directory.GetFiles(FilePath.MATERIAL_DIR, "*.xml"); //searchOption无法完全读取文件,设置*.xml,xmla、xmlb、xmlc都会获取 string[] allFiles = System.IO.Directory.GetFiles(FilePath.MATERIAL_DIR, "*.xml"); //searchOption无法完全读取文件,设置*.xml,xmla、xmlb、xmlc都会获取
...@@ -124,7 +124,10 @@ namespace BLL ...@@ -124,7 +124,10 @@ namespace BLL
result.Add(mateTemp[i].Clone()); result.Add(mateTemp[i].Clone());
return result; return result;
} }
/// <summary>
/// ocr识别结果
/// </summary>
string[] regOcrCodes = null;
/// <summary> /// <summary>
/// 匹配模板 /// 匹配模板
/// </summary> /// </summary>
...@@ -134,7 +137,7 @@ namespace BLL ...@@ -134,7 +137,7 @@ namespace BLL
/// <param name="keyword">关键字和对应的内容</param> /// <param name="keyword">关键字和对应的内容</param>
/// <param name="isCodeUsed"></param> /// <param name="isCodeUsed"></param>
/// <returns></returns> /// <returns></returns>
public bool MatchingTemplate(List<BarcodeInfo> code, string firstMaterial,bool analyisMode, out string mateName, out Dictionary<string, string> keyword, out bool[] isCodeUsed) public bool MatchingTemplate(List<BarcodeInfo> code, string firstMaterial, bool analyisMode, out string mateName, out Dictionary<string, string> keyword, out bool[] isCodeUsed)
{ {
if (Directory.Exists("ocr")) if (Directory.Exists("ocr"))
Directory.Delete("ocr", true); Directory.Delete("ocr", true);
...@@ -142,16 +145,23 @@ namespace BLL ...@@ -142,16 +145,23 @@ namespace BLL
mateName = ""; mateName = "";
keyword = null; keyword = null;
isCodeUsed = null; isCodeUsed = null;
code.ForEach((c)=> { code.ForEach((c) =>
{
LogNet.log.Info($"扫描到 {c.CodeType},{c.Text}"); LogNet.log.Info($"扫描到 {c.CodeType},{c.Text}");
}); });
MatchAnalysis.StartNewAnalysis(code); MatchAnalysis.StartNewAnalysis(code);
if (Config.Func_EnabledOCR)
{
//保存需要识别ocr的区域
CurrntBitmap?.Save(@"ocr.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
regOcrCodes = OcrRecognize("..\\ocr.jpg");
LogNet.log.Info($"OCR 识别结果:{string.Join(",", regOcrCodes)}");
}
//优先匹配 //优先匹配
int firstIndex = mateTemp.FindIndex(math => math.Name == firstMaterial); int firstIndex = mateTemp.FindIndex(math => math.Name == firstMaterial);
if (firstIndex > -1) if (firstIndex > -1)
{ {
LogNet.log.Info("优先匹配 " + mateTemp[firstIndex].Name);
if (TemplateExtract(firstIndex, code, out keyword, out isCodeUsed)) if (TemplateExtract(firstIndex, code, out keyword, out isCodeUsed))
{ {
//if (string.IsNullOrEmpty(mateName)) //if (string.IsNullOrEmpty(mateName))
...@@ -168,8 +178,7 @@ namespace BLL ...@@ -168,8 +178,7 @@ namespace BLL
if (mateTemp[i].PrimaryCode == -1) continue; if (mateTemp[i].PrimaryCode == -1) continue;
int index = mateTemp[i].Code.FindIndex(match => match.ID == mateTemp[i].PrimaryCode); int index = mateTemp[i].Code.FindIndex(match => match.ID == mateTemp[i].PrimaryCode);
if (index == -1) continue; if (index == -1) continue;
string text = mateTemp[i].Match.Find(m=>m.CodeID== mateTemp[i].Code[index].ID).Keyword; string text = mateTemp[i].Match.Find(m => m.CodeID == mateTemp[i].Code[index].ID).Keyword;
LogNet.log.Info("带主键[" + text + "]匹配 " + mateTemp[i].Name);
if (TemplateExtract(i, code, out keyword, out isCodeUsed)) if (TemplateExtract(i, code, out keyword, out isCodeUsed))
{ {
//if (string.IsNullOrEmpty(mateName)) //if (string.IsNullOrEmpty(mateName))
...@@ -184,7 +193,6 @@ namespace BLL ...@@ -184,7 +193,6 @@ namespace BLL
{ {
if (i == firstIndex) continue; if (i == firstIndex) continue;
if (mateTemp[i].PrimaryCode != -1) continue; if (mateTemp[i].PrimaryCode != -1) continue;
LogNet.log.Info("不带主键匹配 " + mateTemp[i].Name);
if (TemplateExtract(i, code, out keyword, out isCodeUsed)) if (TemplateExtract(i, code, out keyword, out isCodeUsed))
{ {
//if (string.IsNullOrEmpty(mateName)) //if (string.IsNullOrEmpty(mateName))
...@@ -399,16 +407,21 @@ namespace BLL ...@@ -399,16 +407,21 @@ namespace BLL
for (int j = 0; j < code.Count; j++) for (int j = 0; j < code.Count; j++)
{ {
Dictionary<string, string> matchKey = CodeMatch(code[j], codeMatch); Dictionary<string, string> matchKey = CodeMatch(code[j], codeMatch);
if (matchKey != null && matchKey.Count>0) if (matchKey != null && matchKey.Count > 0)
{ {
isCodeUsed[j] = true; isCodeUsed[j] = true;
foreach (string key in matchKey.Keys) foreach (string key in matchKey.Keys)
{ {
if (!keyword.ContainsKey(key)) if (!keyword.ContainsKey(key))
{
keyword.Add(key, matchKey[key]); keyword.Add(key, matchKey[key]);
LogNet.log.Info($"{mateTemp[index].Name} 匹配 [{key}={matchKey[key]}]");
}
} }
var ocrmatch = mateTemp[index].Ocr.FindAll(o => o.CodeID == codeMatch[0].CodeID); var ocrmatch = mateTemp[index].Ocr.FindAll(o => o.CodeID == codeMatch[0].CodeID);
foreach (var o in ocrmatch) { foreach (var o in ocrmatch)
{
ocrlist.Add(o); ocrlist.Add(o);
ocrcode.Add(code[j]); ocrcode.Add(code[j]);
} }
...@@ -417,31 +430,77 @@ namespace BLL ...@@ -417,31 +430,77 @@ namespace BLL
} }
} }
} }
LogNet.log.Info("OCR匹配 " + ocrlist.Count); if (Config.Func_EnabledOCR)
{
if (ocrlist.Count > 0) if (ocrlist.Count > 0)
{ {
LogNet.log.Info($"{mateTemp[index].Name} 开始OCR匹配");
LogNet.log.Info("开始OCR匹配 ");
//增加ocr匹配
// OCR oCR = new();
for (int i = 0; i < ocrlist.Count; i++) for (int i = 0; i < ocrlist.Count; i++)
{ {
List<MaterialCodeMatch> codeMatch = mateTemp[index].Match.FindAll(match => match.CodeID == ocrlist[i].ID); List<MaterialCodeMatch> codeMatch = mateTemp[index].Match.FindAll(match => match.CodeID == ocrlist[i].ID);
matchCount += codeMatch.Count; //matchCount += codeMatch.Count;
//保存需要识别ocr的区域
//CodeOcr(mateTemp[index].Name, ocrcode[i], ocrlist[i], CurrntBitmap, out string ocrname);
//CurrntBitmap?.Save(@"ocr.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
foreach (string regCode in regOcrCodes)
{
if (string.IsNullOrEmpty(regCode)) continue;
var x = new BarcodeInfo() { Text = regCode, CodeType = "OCR" };
Dictionary<string, string> matchKey = CodeMatch(x, codeMatch);
if (matchKey != null)
{
foreach (string key in matchKey.Keys)
{
if (!keyword.ContainsKey(regCode))
{
keyword.Add(key, matchKey[key]);
LogNet.log.Info($"{mateTemp[index].Name} OCR匹配 [{key}={matchKey[key]}]");
}
}
}
}
Bitmap bmp = CodeOcr(mateTemp[index].Name,ocrcode[i], ocrlist[i], CurrntBitmap,out string ocrname); }
LogNet.log.Info($"{mateTemp[index].Name} 结束OCR匹配 ");
}
}
if (matchCount == 0)
{
return false;
}
else
{
//if (keyword.Count == matchCount)
{
MatchAnalysis.TemplateResult(true);
return true;
}
//else
//{
// return false;
//}
}
}
public string[] OcrRecognize(string path)
{
bool algro = ConfigHelper.Config.Get("UsePaddleOCR", true); bool algro = ConfigHelper.Config.Get("UsePaddleOCR", true);
string codeOcr = ""; string codeOcr = "";
if (algro) if (algro)
{ {
codeOcr=PaddleOCRHelper.StartTest("..\\ocr.jpg"); codeOcr = PaddleOCRHelper.StartTest(path);
} }
else else
{ {
#region ocrr文字提取开始 #region ocrr文字提取开始
//ocr匹配调用 //ocr匹配调用
var resp = namedPipeClient.Request("..\\ocr.jpg"); var resp = namedPipeClient.Request(path);
//ocr结果 //ocr结果
var lp = JsonConvert.DeserializeObject<List<TextBlock>>(resp); var lp = JsonConvert.DeserializeObject<List<TextBlock>>(resp);
double maxbox = 0; double maxbox = 0;
...@@ -456,33 +515,9 @@ namespace BLL ...@@ -456,33 +515,9 @@ namespace BLL
} }
#endregion ocr文字提取结束 #endregion ocr文字提取结束
} }
return codeOcr.Replace(" ", "").Replace("\r", "").Split('\n');
LogNet.log.Info($"OCR匹配 {ocrname} = {codeOcr}");
var x = new BarcodeInfo() {Text=codeOcr,CodeType="OCR"};
Dictionary<string, string> matchKey = CodeMatch(x, codeMatch);
if (matchKey != null)
{
foreach (string key in matchKey.Keys)
keyword.Add(key, matchKey[key]);
} }
} private Bitmap CodeOcr(string templatename, BarcodeInfo code, MaterialCodeOCR ocr, Bitmap codeImage, out string ocrname)
LogNet.log.Info("结束OCR匹配 ");
}
if (matchCount == 0)
return false;
else
{
if (keyword.Count == matchCount)
{
MatchAnalysis.TemplateResult(true);
return true;
}
else
return false;
}
}
private Bitmap CodeOcr(string templatename, BarcodeInfo code, MaterialCodeOCR ocr, Bitmap codeImage,out string ocrname)
{ {
ocrname = ""; ocrname = "";
int smside = ocr.Width < ocr.Height ? ocr.Width : ocr.Height; int smside = ocr.Width < ocr.Height ? ocr.Width : ocr.Height;
...@@ -492,13 +527,13 @@ namespace BLL ...@@ -492,13 +527,13 @@ namespace BLL
int Width = ocr.Width + smside * 2; int Width = ocr.Width + smside * 2;
int Height = ocr.Height + smside * 2; int Height = ocr.Height + smside * 2;
var a = code.Angle >= 0 ? 180+code.Angle*-1 : 180 + Math.Abs(code.Angle); var a = code.Angle >= 0 ? 180 + code.Angle * -1 : 180 + Math.Abs(code.Angle);
double centerX = code.Center.X; double centerX = code.Center.X;
double centerY = code.Center.Y; double centerY = code.Center.Y;
var cent = PointWithAngle(code.Center, a, code.Size.Width/2); var cent = PointWithAngle(code.Center, a, code.Size.Width / 2);
centerX=cent.X; centerX = cent.X;
centerY=cent.Y; centerY = cent.Y;
double aa = Math.Atan2(centerY, centerX); double aa = Math.Atan2(centerY, centerX);
...@@ -549,13 +584,14 @@ namespace BLL ...@@ -549,13 +584,14 @@ namespace BLL
code = codeMatch[i].CaseSensitive ? codeText : codeText.ToUpper(); code = codeMatch[i].CaseSensitive ? codeText : codeText.ToUpper();
bool ismatch = true; bool ismatch = true;
//匹配CodeType //匹配CodeType
if (codeMatch[i].CheckCodeType && !string.IsNullOrEmpty(codeMatch[i].CodeType) && !string.IsNullOrEmpty(codeinfo.CodeType)) { if (codeMatch[i].CheckCodeType && !string.IsNullOrEmpty(codeMatch[i].CodeType) && !string.IsNullOrEmpty(codeinfo.CodeType))
{
matchCount++; matchCount++;
if (codeinfo.CodeType != codeMatch[i].CodeType) if (codeinfo.CodeType != codeMatch[i].CodeType)
ismatch = false; ismatch = false;
MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"条码类型:{codeMatch[i].CodeType}",$"{codeinfo.CodeType}"); MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"条码类型:{codeMatch[i].CodeType}", $"{codeinfo.CodeType}");
//if (!ismatch) return null; //if (!ismatch) return null;
} }
...@@ -606,7 +642,7 @@ namespace BLL ...@@ -606,7 +642,7 @@ namespace BLL
if (codeMatch[i].MatchMiddleType == 1 && count < codeMatch[i].MiddleTextCount) if (codeMatch[i].MatchMiddleType == 1 && count < codeMatch[i].MiddleTextCount)
ismatch = false; ismatch = false;
var mode = codeMatch[i].MatchMiddleType == 0 ? "相等": codeMatch[i].MatchMiddleType == 1?"至多":"至少"; var mode = codeMatch[i].MatchMiddleType == 0 ? "相等" : codeMatch[i].MatchMiddleType == 1 ? "至多" : "至少";
MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"中间字符:\"{text}\",{mode}匹配:{codeMatch[i].MiddleTextCount}次", $"NG"); MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"中间字符:\"{text}\",{mode}匹配:{codeMatch[i].MiddleTextCount}次", $"NG");
//if (!ismatch) return null; //if (!ismatch) return null;
} }
...@@ -651,7 +687,8 @@ namespace BLL ...@@ -651,7 +687,8 @@ namespace BLL
} }
var filtercode = code.Substring(startIndex, length); var filtercode = code.Substring(startIndex, length);
if (codeMatch[i].MatchISNumber) { if (codeMatch[i].MatchISNumber)
{
if (!int.TryParse(filtercode, out _)) if (!int.TryParse(filtercode, out _))
ismatch = false; ismatch = false;
MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"是否为数字", $"NG"); MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"是否为数字", $"NG");
...@@ -739,7 +776,7 @@ namespace BLL ...@@ -739,7 +776,7 @@ namespace BLL
} }
public static void OffsetCoordinate(float x, float y, double radian, double offsetX, out double newX, out double newY) public static void OffsetCoordinate(float x, float y, double radian, double offsetX, out double newX, out double newY)
{ {
var aaa = PointWithAngle(new System.Drawing.PointF(x, y), radian+270, offsetX); var aaa = PointWithAngle(new System.Drawing.PointF(x, y), radian + 270, offsetX);
newX = aaa.X; newX = aaa.X;
newY = aaa.Y; newY = aaa.Y;
} }
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public class Setting_Str
{
}
}
...@@ -47,10 +47,9 @@ namespace SmartScan ...@@ -47,10 +47,9 @@ namespace SmartScan
LogNet.log.Info($"加载IO模块,IP地址:{ip},iomodule:{Common.config.iomodule}"); LogNet.log.Info($"加载IO模块,IP地址:{ip},iomodule:{Common.config.iomodule}");
} }
if (Common.config.EnabledOCR) if (Config.Func_EnabledOCR)
{ {
//Common.ocr = new(); LogNet.log.Info("启用OCR模块");
LogNet.log.Info("加载OCR模块");
} }
Common.lightSource = new(); Common.lightSource = new();
......
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using Asa.FaceControl; using Asa.FaceControl;
using BLL;
using Model; using Model;
namespace SmartScan namespace SmartScan
...@@ -17,7 +18,7 @@ namespace SmartScan ...@@ -17,7 +18,7 @@ namespace SmartScan
public UsrMaterialTemplate() public UsrMaterialTemplate()
{ {
InitializeComponent(); InitializeComponent();
BtnOcrCode.Enabled = Common.config.EnabledOCR; BtnOcrCode.Enabled = Config.Func_EnabledOCR;
LstMate.Items.AddRange(Common.mateEdit.Name); LstMate.Items.AddRange(Common.mateEdit.Name);
mateCopy = Common.mateEdit.ToCopy(); mateCopy = Common.mateEdit.ToCopy();
Language.SetLanguage(this); Language.SetLanguage(this);
......
此文件的差异太大,无法显示。
此文件的差异太大,无法显示。
...@@ -28,107 +28,81 @@ ...@@ -28,107 +28,81 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Paddle));
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.button4 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// textBox1 // textBox1
// //
this.textBox1.Location = new System.Drawing.Point(11, 11); this.textBox1.Location = new System.Drawing.Point(15, 14);
this.textBox1.Margin = new System.Windows.Forms.Padding(2); this.textBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(569, 21); this.textBox1.Size = new System.Drawing.Size(757, 25);
this.textBox1.TabIndex = 0; this.textBox1.TabIndex = 0;
// //
// button1 // button1
// //
this.button1.Location = new System.Drawing.Point(594, 11); this.button1.Location = new System.Drawing.Point(792, 14);
this.button1.Margin = new System.Windows.Forms.Padding(2); this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(105, 29); this.button1.Size = new System.Drawing.Size(140, 36);
this.button1.TabIndex = 1; this.button1.TabIndex = 1;
this.button1.Text = "打开"; this.button1.Text = "打开";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// button2
//
this.button2.Location = new System.Drawing.Point(119, 68);
this.button2.Margin = new System.Windows.Forms.Padding(2);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(112, 39);
this.button2.TabIndex = 2;
this.button2.Text = "python识别";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// pictureBox1
//
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pictureBox1.Location = new System.Drawing.Point(0, 213);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(745, 470);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox1.TabIndex = 3;
this.pictureBox1.TabStop = false;
//
// textBox2 // textBox2
// //
this.textBox2.Dock = System.Windows.Forms.DockStyle.Bottom; this.textBox2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.textBox2.Location = new System.Drawing.Point(0, 118); this.textBox2.Location = new System.Drawing.Point(0, 153);
this.textBox2.Margin = new System.Windows.Forms.Padding(2); this.textBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox2.Multiline = true; this.textBox2.Multiline = true;
this.textBox2.Name = "textBox2"; this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(745, 95); this.textBox2.Size = new System.Drawing.Size(993, 409);
this.textBox2.TabIndex = 4; this.textBox2.TabIndex = 4;
this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(494, 81); this.label1.Location = new System.Drawing.Point(401, 84);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(49, 13); this.label1.Size = new System.Drawing.Size(55, 15);
this.label1.TabIndex = 7; this.label1.TabIndex = 7;
this.label1.Text = "label1"; this.label1.Text = "label1";
// //
// button4 // button4
// //
this.button4.Location = new System.Drawing.Point(262, 68); this.button4.Location = new System.Drawing.Point(146, 67);
this.button4.Margin = new System.Windows.Forms.Padding(2); this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button4.Name = "button4"; this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(112, 39); this.button4.Size = new System.Drawing.Size(149, 49);
this.button4.TabIndex = 8; this.button4.TabIndex = 8;
this.button4.Text = "c++识别"; this.button4.Text = "ocr识别";
this.button4.UseVisualStyleBackColor = true; this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click); this.button4.Click += new System.EventHandler(this.button4_Click);
// //
// Paddle // Paddle
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(745, 683); this.ClientSize = new System.Drawing.Size(993, 562);
this.Controls.Add(this.button4); this.Controls.Add(this.button4);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox2);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Margin = new System.Windows.Forms.Padding(2); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "Paddle"; this.Name = "Paddle";
this.Text = "PaddleOcr"; this.Text = "PaddleOcr";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Paddle_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Paddle_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
...@@ -138,8 +112,6 @@ ...@@ -138,8 +112,6 @@
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button4;
......
...@@ -56,7 +56,7 @@ namespace paddleOCR ...@@ -56,7 +56,7 @@ namespace paddleOCR
try try
{ {
Stream s = File.Open(System.Windows.Forms.Application.StartupPath + @"\ocr_result.jpg", FileMode.Open); Stream s = File.Open(System.Windows.Forms.Application.StartupPath + @"\ocr_result.jpg", FileMode.Open);
pictureBox1.Image = Bitmap.FromStream(s); // pictureBox1.Image = Bitmap.FromStream(s);
s.Close(); s.Close();
s.Dispose(); s.Dispose();
} }
...@@ -91,7 +91,7 @@ namespace paddleOCR ...@@ -91,7 +91,7 @@ namespace paddleOCR
try try
{ {
Stream s = File.Open(System.Windows.Forms.Application.StartupPath + @"\ocr_result.jpg", FileMode.Open); Stream s = File.Open(System.Windows.Forms.Application.StartupPath + @"\ocr_result.jpg", FileMode.Open);
pictureBox1.Image = Bitmap.FromStream(s); // pictureBox1.Image = Bitmap.FromStream(s);
s.Close(); s.Close();
s.Dispose(); s.Dispose();
} }
...@@ -129,7 +129,7 @@ namespace paddleOCR ...@@ -129,7 +129,7 @@ namespace paddleOCR
try try
{ {
Stream s = File.Open(System.Windows.Forms.Application.StartupPath + @"\ocr_result.jpg", FileMode.Open); Stream s = File.Open(System.Windows.Forms.Application.StartupPath + @"\ocr_result.jpg", FileMode.Open);
pictureBox1.Image = Bitmap.FromStream(s); // pictureBox1.Image = Bitmap.FromStream(s);
s.Close(); s.Close();
s.Dispose(); s.Dispose();
} }
......
...@@ -117,4 +117,81 @@ ...@@ -117,4 +117,81 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAACMuAAAjLgAAAAAAAAAA
AADlPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv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zb/5T82/+U/Nv/lQTj/5kU8/+M0Kv/wjYj///////nS
0P/kOTD/5UE4/+VCOf/lQTj/5UE4/+VBOP/lQjn/5T82/+ZGPf/86ej//////+xya//kNCv/5kM6/+VB
Of/lQTj/5UE4/+VBOP/lQTj/5UA3/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+Q2LP/kNSz/4zMp/+U8
M//75eT//////+xxav/jMij/5DYt/+Q1K//kNSv/5DUr/+Q0K//kOjH/4zEn//KdmP//////98XC/+Q2
LP/kOTD/5DQr/+Q1K//kNSv/5DUr/+Q1K//kOzL/5UI5/+U/Nv/lPzb/5T82/+U/Nv/lPzb/62xl/+xv
af/scGr/6mNc//a5tv//////98K//+ZDOv/sdW//621m/+tuZ//rbWf/629o/+plXv/kOC//50pC//74
9///////6mFZ/+leVv/scmz/621m/+tuZ//rbmf/625n/+dQR//jNCr/5UA3/+U/Nv/lPzb/5UI5/+Q0
Kv/3wL3//////////////////////////////v7/7HFr//719f////////////////////////////rc
2v/nSkL/86Wh///////zp6P/8p2Y//////////////////////////////z7//GWkf/kNy7/5UA3/+U/
Nv/lQTj/5Dgv/+lbVP/3xcL/9sC9//fCv//2vbr/+tzb///////zqqb/7Xdx//fBvv/1s7D/9bay//Wz
r//509H///////ra2P/pX1j///////739//qZ2D/9LCs//W3s//1tbL/9bSx//a7uP/++fj//////+6C
fP/jNCr/5UI5/+U/Nv/lQDf/5Dsy/+MzKv/kNCv/5DYt/+IsIv/pXFT////////7+//nTUT/4iwi/+M0
Kv/jNCr/4zQq/+Q3Lv/3w8H//////+tsZf/1sq7///////KhnP/hJBn/5DYs/+MzKf/kNSz/4y0j/+xz
bP//////+dHO/+Q3Lv/lQTj/5T82/+U/Nv/lQDf/5UI5/+VBOP/lQTj/5kQ7/+Q0K//2v7z///////Ok
oP/kNCr/5kU8/+U8M//lQDj/4icd//Khnf//////7Xp0/+leVv///////fHw/+dORf/lPzb/5T82/+U+
Nf/jNCr/501E///////63Nr/5Dsx/+VA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+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/Nv/lPzb/5T82/+U/
Nv/lPzb/5T82/+U/Nv/lPzb/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
</value>
</data>
</root> </root>
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!