Commit 1cbbaf0f 刘韬

更新eyemDecode

1 个父辈 66950e28
...@@ -131,6 +131,7 @@ ...@@ -131,6 +131,7 @@
this.btnLearn.TabIndex = 10; this.btnLearn.TabIndex = 10;
this.btnLearn.Text = "学习"; this.btnLearn.Text = "学习";
this.btnLearn.UseVisualStyleBackColor = true; this.btnLearn.UseVisualStyleBackColor = true;
this.btnLearn.Visible = false;
this.btnLearn.Click += new System.EventHandler(this.btnLearn_Click); this.btnLearn.Click += new System.EventHandler(this.btnLearn_Click);
// //
// btnDCode // btnDCode
...@@ -186,6 +187,7 @@ ...@@ -186,6 +187,7 @@
this.cmbCount.Name = "cmbCount"; this.cmbCount.Name = "cmbCount";
this.cmbCount.Size = new System.Drawing.Size(66, 25); this.cmbCount.Size = new System.Drawing.Size(66, 25);
this.cmbCount.TabIndex = 16; this.cmbCount.TabIndex = 16;
this.cmbCount.Visible = false;
// //
// lblCount // lblCount
// //
...@@ -196,6 +198,7 @@ ...@@ -196,6 +198,7 @@
this.lblCount.TabIndex = 15; this.lblCount.TabIndex = 15;
this.lblCount.Text = "条码数量:"; this.lblCount.Text = "条码数量:";
this.lblCount.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.lblCount.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblCount.Visible = false;
// //
// btnCameraImage // btnCameraImage
// //
...@@ -260,6 +263,7 @@ ...@@ -260,6 +263,7 @@
this.cmbCodeType.Name = "cmbCodeType"; this.cmbCodeType.Name = "cmbCodeType";
this.cmbCodeType.Size = new System.Drawing.Size(154, 25); this.cmbCodeType.Size = new System.Drawing.Size(154, 25);
this.cmbCodeType.TabIndex = 23; this.cmbCodeType.TabIndex = 23;
this.cmbCodeType.Visible = false;
this.cmbCodeType.SelectedIndexChanged += new System.EventHandler(this.cmbCodeType_SelectedIndexChanged); this.cmbCodeType.SelectedIndexChanged += new System.EventHandler(this.cmbCodeType_SelectedIndexChanged);
// //
// label3 // label3
...@@ -271,6 +275,7 @@ ...@@ -271,6 +275,7 @@
this.label3.TabIndex = 22; this.label3.TabIndex = 22;
this.label3.Text = "条码类型:"; this.label3.Text = "条码类型:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label3.Visible = false;
// //
// chbUseParam // chbUseParam
// //
...@@ -319,6 +324,8 @@ ...@@ -319,6 +324,8 @@
// chbZxing // chbZxing
// //
this.chbZxing.AutoSize = true; this.chbZxing.AutoSize = true;
this.chbZxing.Checked = true;
this.chbZxing.CheckState = System.Windows.Forms.CheckState.Checked;
this.chbZxing.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.chbZxing.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbZxing.Location = new System.Drawing.Point(792, 16); this.chbZxing.Location = new System.Drawing.Point(792, 16);
this.chbZxing.Name = "chbZxing"; this.chbZxing.Name = "chbZxing";
......
...@@ -356,9 +356,9 @@ namespace CodeLibrary ...@@ -356,9 +356,9 @@ namespace CodeLibrary
//pictureBox1.Image = (Image)bitmap.Clone(); //pictureBox1.Image = (Image)bitmap.Clone();
//HObject hoImage = HDCodeHelper.Bitmap2HObjectBpp24(bitmap); //HObject hoImage = HDCodeHelper.Bitmap2HObjectBpp24(bitmap);
HDCodeLearnHelper.DefaultImage = bitmap; HDCodeLearnHelper.DefaultImage = bitmap;
HDCodeLearnHelper.DefaultBitmap = b;
ShowImage(bitmap); ShowImage(bitmap);
} }
HDCodeLearnHelper.DefaultBitmap = b;
} }
else else
{ {
...@@ -494,6 +494,7 @@ namespace CodeLibrary ...@@ -494,6 +494,7 @@ namespace CodeLibrary
private void FrmCodeDecode_FormClosing(object sender, FormClosingEventArgs e) private void FrmCodeDecode_FormClosing(object sender, FormClosingEventArgs e)
{ {
HDLogUtil.info("关闭所有相机");
Camera._cam.CloseAll(); Camera._cam.CloseAll();
} }
......
...@@ -232,7 +232,7 @@ namespace CodeLibrary ...@@ -232,7 +232,7 @@ namespace CodeLibrary
{ {
return CaptureOnImage(name, out _); return CaptureOnImage(name, out _);
} }
public override HObject CaptureOnImage(string name,out Bitmap bmp) public override HObject CaptureOnImage(string name,out Bitmap bmp,bool nohalcon=false)
{ {
HObject hoImage = null; HObject hoImage = null;
bmp = null; bmp = null;
......
...@@ -113,7 +113,7 @@ namespace CodeLibrary ...@@ -113,7 +113,7 @@ namespace CodeLibrary
// public abstract void GrabStop(int index); // public abstract void GrabStop(int index);
public abstract Bitmap GrabOneImage(string name); public abstract Bitmap GrabOneImage(string name);
public abstract HObject CaptureOnImage(string name ); public abstract HObject CaptureOnImage(string name );
public abstract HObject CaptureOnImage(string name,out Bitmap bmp); public abstract HObject CaptureOnImage(string name, out Bitmap bmp, bool nohalcon = false);
} }
} }
...@@ -50,10 +50,13 @@ namespace CodeLibrary ...@@ -50,10 +50,13 @@ namespace CodeLibrary
{ {
if (cameraCurr == null) if (cameraCurr == null)
return; return;
HDLogUtil.info(" cameraCurr.Length : " + cameraCurr.Length.ToString());
for (int i = 0; i < cameraCurr.Length; i++) for (int i = 0; i < cameraCurr.Length; i++)
{ {
if (cameraCurr[i] != null) if (cameraCurr[i] != null)
{ {
HDLogUtil.info($" cameraCurr[{i}] ");
_isOpen[i] = false; _isOpen[i] = false;
cameraCurr[i].MV_CC_CloseDevice_NET(); cameraCurr[i].MV_CC_CloseDevice_NET();
cameraCurr[i].MV_CC_DestroyDevice_NET(); cameraCurr[i].MV_CC_DestroyDevice_NET();
...@@ -351,7 +354,7 @@ namespace CodeLibrary ...@@ -351,7 +354,7 @@ namespace CodeLibrary
return r; return r;
} }
public override HObject CaptureOnImage(string name, out Bitmap bmp) public override HObject CaptureOnImage(string name, out Bitmap bmp, bool nohalcon=false)
{ {
HObject hoImage = null; HObject hoImage = null;
bmp = null; bmp = null;
...@@ -390,7 +393,8 @@ namespace CodeLibrary ...@@ -390,7 +393,8 @@ namespace CodeLibrary
+ "] , FrameNum[" + Convert.ToString(FrameInfo.stFrameInfo.nFrameNum) + "]"); + "] , FrameNum[" + Convert.ToString(FrameInfo.stFrameInfo.nFrameNum) + "]");
//HObject ho_Imagetemp; //HObject ho_Imagetemp;
HOperatorSet.GenImage1(out hoImage, "byte", FrameInfo.stFrameInfo.nWidth, FrameInfo.stFrameInfo.nHeight, FrameInfo.pBufAddr); if (!nohalcon)
HOperatorSet.GenImage1(out hoImage, "byte", FrameInfo.stFrameInfo.nWidth, FrameInfo.stFrameInfo.nHeight, FrameInfo.pBufAddr);
try try
{ {
......
...@@ -50,8 +50,7 @@ namespace CodeLibrary ...@@ -50,8 +50,7 @@ namespace CodeLibrary
eyemRect.iYs = 0; eyemRect.iYs = 0;
eyemRect.iWidth = eyemImage.iWidth; eyemRect.iWidth = eyemImage.iWidth;
eyemRect.iHeight = eyemImage.iHeight; eyemRect.iHeight = eyemImage.iHeight;
string codeType = "DataMatrix";//QRCode string codeType = "QR_CODE|DATA_MATRIX"; //QRCode
codeType = "QRCode";
int ipNum; int ipNum;
EyemBarCode* tpResults; EyemBarCode* tpResults;
...@@ -98,7 +97,7 @@ namespace CodeLibrary ...@@ -98,7 +97,7 @@ namespace CodeLibrary
} }
} }
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)] [DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemDetectAndDecode(EyemImage tpImage, EyemRect tpRoi, string fileName, string strCodeType, out DataCodeHandle hObject, out EyemBarCode* tpResults, out int ipNum, bool bUseNiBlack, int iBlockSize, int iRangeC, int iSymbolMin, int iSymbolMax, double dScaleUpAndDown = 0.5, double dToleErr = 0.5, double dMinorStep = 1.0); private static extern int eyemDetectAndDecode(EyemImage tpImage, EyemRect tpRoi, string fileName, string strCodeType, out DataCodeHandle hObject, out EyemBarCode* tpResults, out int ipNum, bool bUseNiBlack, int iBlockSize, int iRangeC, int iSymbolMin, int iSymbolMax, double dScaleUpAndDown = 1, double dToleErr = 0.5, double dMinorStep = 1.0);
/// <summary> /// <summary>
/// 读取图像 /// 读取图像
...@@ -140,6 +139,7 @@ namespace CodeLibrary ...@@ -140,6 +139,7 @@ namespace CodeLibrary
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct EyemBarCode public struct EyemBarCode
{ {
public double dAngle; // 角度
public int iCenterX; // y坐标 public int iCenterX; // y坐标
public int iCenterY; // y坐标 public int iCenterY; // y坐标
public IntPtr hType; // 码类型 public IntPtr hType; // 码类型
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!