Commit 9e753723 张东亮

1

1 个父辈 9c2471ed
......@@ -30,6 +30,7 @@ namespace SmartScan
private void InitializeComponent()
{
this.facePanel1 = new Asa.FaceControl.FacePanel();
this.BtnSaveImage = new Asa.FaceControl.FaceButton();
this.PicShow = new Asa.FaceControl.FacePictureBox();
this.LstCode = new Asa.FaceControl.FaceListBox();
this.BtnScanCode = new Asa.FaceControl.FaceButton();
......@@ -37,7 +38,6 @@ namespace SmartScan
this.BtnCameraImage = new Asa.FaceControl.FaceButton();
this.BtnCloseLight = new Asa.FaceControl.FaceButton();
this.BtnOpenLight = new Asa.FaceControl.FaceButton();
this.BtnSaveImage = new Asa.FaceControl.FaceButton();
this.facePanel1.SuspendLayout();
this.SuspendLayout();
//
......@@ -55,15 +55,32 @@ namespace SmartScan
this.facePanel1.Controls.Add(this.BtnCloseLight);
this.facePanel1.Controls.Add(this.BtnOpenLight);
this.facePanel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.facePanel1.Location = new System.Drawing.Point(3, 3);
this.facePanel1.Location = new System.Drawing.Point(4, 4);
this.facePanel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.facePanel1.Name = "facePanel1";
this.facePanel1.Padding = new System.Windows.Forms.Padding(3);
this.facePanel1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.facePanel1.ShowText = false;
this.facePanel1.Size = new System.Drawing.Size(674, 311);
this.facePanel1.Size = new System.Drawing.Size(899, 389);
this.facePanel1.TabIndex = 0;
this.facePanel1.Text = "facePanel1";
this.facePanel1.TitleFont = new System.Drawing.Font("宋体", 12F);
//
// BtnSaveImage
//
this.BtnSaveImage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.BtnSaveImage.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.BtnSaveImage.BorderWidth = 2;
this.BtnSaveImage.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.BtnSaveImage.HoldPress = false;
this.BtnSaveImage.Location = new System.Drawing.Point(245, 135);
this.BtnSaveImage.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnSaveImage.Name = "BtnSaveImage";
this.BtnSaveImage.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnSaveImage.Size = new System.Drawing.Size(229, 56);
this.BtnSaveImage.TabIndex = 7;
this.BtnSaveImage.Text = "保存图像";
this.BtnSaveImage.Click += new System.EventHandler(this.BtnSaveImage_Click);
//
// PicShow
//
this.PicShow.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
......@@ -73,10 +90,11 @@ namespace SmartScan
this.PicShow.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.PicShow.BorderWidth = 2;
this.PicShow.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.PicShow.Location = new System.Drawing.Point(362, 6);
this.PicShow.Location = new System.Drawing.Point(483, 8);
this.PicShow.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.PicShow.Name = "PicShow";
this.PicShow.Padding = new System.Windows.Forms.Padding(3);
this.PicShow.Size = new System.Drawing.Size(306, 299);
this.PicShow.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.PicShow.Size = new System.Drawing.Size(408, 374);
this.PicShow.TabIndex = 6;
this.PicShow.Text = "facePictureBox1";
//
......@@ -90,11 +108,12 @@ namespace SmartScan
this.LstCode.Font = new System.Drawing.Font("宋体", 9F);
this.LstCode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.LstCode.ItemHeight = 40;
this.LstCode.Location = new System.Drawing.Point(6, 159);
this.LstCode.Location = new System.Drawing.Point(8, 199);
this.LstCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.LstCode.Name = "LstCode";
this.LstCode.Padding = new System.Windows.Forms.Padding(3);
this.LstCode.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.LstCode.SelectedIndex = -1;
this.LstCode.Size = new System.Drawing.Size(350, 146);
this.LstCode.Size = new System.Drawing.Size(467, 182);
this.LstCode.TabIndex = 5;
this.LstCode.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
//
......@@ -105,12 +124,13 @@ namespace SmartScan
this.BtnScanCode.BorderWidth = 2;
this.BtnScanCode.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.BtnScanCode.HoldPress = false;
this.BtnScanCode.Location = new System.Drawing.Point(6, 108);
this.BtnScanCode.Location = new System.Drawing.Point(8, 135);
this.BtnScanCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnScanCode.Name = "BtnScanCode";
this.BtnScanCode.Padding = new System.Windows.Forms.Padding(3);
this.BtnScanCode.Size = new System.Drawing.Size(172, 45);
this.BtnScanCode.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnScanCode.Size = new System.Drawing.Size(229, 56);
this.BtnScanCode.TabIndex = 4;
this.BtnScanCode.Text = "条码识别";
this.BtnScanCode.Text = "识别";
this.BtnScanCode.Click += new System.EventHandler(this.BtnScanCode_Click);
//
// BtnLocalImage
......@@ -120,10 +140,11 @@ namespace SmartScan
this.BtnLocalImage.BorderWidth = 2;
this.BtnLocalImage.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.BtnLocalImage.HoldPress = false;
this.BtnLocalImage.Location = new System.Drawing.Point(184, 57);
this.BtnLocalImage.Location = new System.Drawing.Point(245, 71);
this.BtnLocalImage.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnLocalImage.Name = "BtnLocalImage";
this.BtnLocalImage.Padding = new System.Windows.Forms.Padding(3);
this.BtnLocalImage.Size = new System.Drawing.Size(172, 45);
this.BtnLocalImage.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnLocalImage.Size = new System.Drawing.Size(229, 56);
this.BtnLocalImage.TabIndex = 3;
this.BtnLocalImage.Text = "本地图像";
this.BtnLocalImage.Click += new System.EventHandler(this.BtnLocalImage_Click);
......@@ -135,10 +156,11 @@ namespace SmartScan
this.BtnCameraImage.BorderWidth = 2;
this.BtnCameraImage.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.BtnCameraImage.HoldPress = false;
this.BtnCameraImage.Location = new System.Drawing.Point(6, 57);
this.BtnCameraImage.Location = new System.Drawing.Point(8, 71);
this.BtnCameraImage.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnCameraImage.Name = "BtnCameraImage";
this.BtnCameraImage.Padding = new System.Windows.Forms.Padding(3);
this.BtnCameraImage.Size = new System.Drawing.Size(172, 45);
this.BtnCameraImage.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnCameraImage.Size = new System.Drawing.Size(229, 56);
this.BtnCameraImage.TabIndex = 2;
this.BtnCameraImage.Text = "相机图像";
this.BtnCameraImage.Click += new System.EventHandler(this.BtnCameraImage_Click);
......@@ -150,10 +172,11 @@ namespace SmartScan
this.BtnCloseLight.BorderWidth = 2;
this.BtnCloseLight.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.BtnCloseLight.HoldPress = false;
this.BtnCloseLight.Location = new System.Drawing.Point(184, 6);
this.BtnCloseLight.Location = new System.Drawing.Point(245, 8);
this.BtnCloseLight.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnCloseLight.Name = "BtnCloseLight";
this.BtnCloseLight.Padding = new System.Windows.Forms.Padding(3);
this.BtnCloseLight.Size = new System.Drawing.Size(172, 45);
this.BtnCloseLight.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnCloseLight.Size = new System.Drawing.Size(229, 56);
this.BtnCloseLight.TabIndex = 1;
this.BtnCloseLight.Text = "关闭";
this.BtnCloseLight.Click += new System.EventHandler(this.BtnCloseLight_Click);
......@@ -165,36 +188,23 @@ namespace SmartScan
this.BtnOpenLight.BorderWidth = 2;
this.BtnOpenLight.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.BtnOpenLight.HoldPress = false;
this.BtnOpenLight.Location = new System.Drawing.Point(6, 6);
this.BtnOpenLight.Location = new System.Drawing.Point(8, 8);
this.BtnOpenLight.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnOpenLight.Name = "BtnOpenLight";
this.BtnOpenLight.Padding = new System.Windows.Forms.Padding(3);
this.BtnOpenLight.Size = new System.Drawing.Size(172, 45);
this.BtnOpenLight.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BtnOpenLight.Size = new System.Drawing.Size(229, 56);
this.BtnOpenLight.TabIndex = 0;
this.BtnOpenLight.Text = "打开光源";
this.BtnOpenLight.Click += new System.EventHandler(this.BtnOpenLight_Click);
//
// BtnSaveImage
//
this.BtnSaveImage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.BtnSaveImage.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.BtnSaveImage.BorderWidth = 2;
this.BtnSaveImage.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.BtnSaveImage.HoldPress = false;
this.BtnSaveImage.Location = new System.Drawing.Point(184, 108);
this.BtnSaveImage.Name = "BtnSaveImage";
this.BtnSaveImage.Padding = new System.Windows.Forms.Padding(3);
this.BtnSaveImage.Size = new System.Drawing.Size(172, 45);
this.BtnSaveImage.TabIndex = 7;
this.BtnSaveImage.Text = "保存图像";
this.BtnSaveImage.Click += new System.EventHandler(this.BtnSaveImage_Click);
//
// UsrCamera
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.facePanel1);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "UsrCamera";
this.Size = new System.Drawing.Size(758, 362);
this.Size = new System.Drawing.Size(1011, 452);
this.facePanel1.ResumeLayout(false);
this.ResumeLayout(false);
......
......@@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using BLL;
using DocumentFormat.OpenXml.Spreadsheet;
using Model;
namespace SmartScan
......@@ -14,7 +16,7 @@ namespace SmartScan
{
InitializeComponent();
Asa.FaceControl.Language.SetLanguage(this);
BtnCameraImage.Enabled = Common.cameraVision==null?false:Common.cameraVision.Count > 0;
BtnCameraImage.Enabled = Common.cameraVision == null ? false : Common.cameraVision.Count > 0;
}
public Asa.FaceControl.FacePanel GetPanel()
......@@ -65,13 +67,6 @@ namespace SmartScan
List<CameraVisionLib.Model.BarcodeInfo> info = Common.cameraVision.GetBarCode(bmp);
LstCode.Items.Clear();
PicShow.CodeCenterClear();
if (info.Count == 0)
{
string text = Asa.FaceControl.Language.Dialog(Model.LanguageDialogKey.CODE_COUNT);
new Asa.FaceControl.FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
return;
}
string[] arr = new string[info.Count];
PointF[] lst = new PointF[info.Count];
for (int i = 0; i < info.Count; i++)
......@@ -79,8 +74,29 @@ namespace SmartScan
arr[i] = string.Format("({0}) ", i + 1) + info[i].Text.Replace("\r\n", "");
lst[i] = info[i].Center;
}
List<string> ocrs = new List<string>();
int startidx = info.Count + 1;
if (Config.Func_EnabledOCR)
{
//保存需要识别ocr的区域
bmp?.Save(@"ocrt.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
string[] regOcrCodes = PaddleOCRHelper.StartTest("..\\ocrt.jpg").Split(';');
foreach (var ocr in regOcrCodes)
{
if (string.IsNullOrEmpty(ocr)) continue;
ocrs.Add($"({startidx}) {ocr} <OCR>");
startidx++;
}
}
if (info.Count == 0)
{
string text = Asa.FaceControl.Language.Dialog(Model.LanguageDialogKey.CODE_COUNT);
new Asa.FaceControl.FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
return;
}
LstCode.Items.AddRange(arr);
if (ocrs.Count > 0)
LstCode.Items.AddRange(ocrs.ToArray());
PicShow.AddCodeCenter(lst);
}
......
......@@ -89,7 +89,7 @@ namespace SmartScan
this.BtnExtractCode.Padding = new System.Windows.Forms.Padding(4);
this.BtnExtractCode.Size = new System.Drawing.Size(227, 56);
this.BtnExtractCode.TabIndex = 17;
this.BtnExtractCode.Text = "条码提取";
this.BtnExtractCode.Text = "提取";
this.BtnExtractCode.Click += new System.EventHandler(this.BtnExtractCode_Click);
//
// BtnPrimaryCode
......@@ -159,7 +159,7 @@ namespace SmartScan
this.BtnScanCode.Padding = new System.Windows.Forms.Padding(4);
this.BtnScanCode.Size = new System.Drawing.Size(461, 56);
this.BtnScanCode.TabIndex = 12;
this.BtnScanCode.Text = "条码识别";
this.BtnScanCode.Text = "识别";
this.BtnScanCode.Click += new System.EventHandler(this.BtnScanCode_Click);
//
// BtnLocalImage
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!