浏览代码

Merge branch 'master' of http://192.168.1.123:10080/SDD1/HOZ

wb_han 5 年之前
父节点
当前提交
bd3bc4b3fc

+ 6 - 6
HOZProject/App.config

@@ -54,11 +54,11 @@
       <!--远程算法地址-->
       <add key="WebServerUrl" value="FIB_degree_recognize,test2,FIB_verify,test4,test5,test6,test7,test8"/>
 
-      <add key="" value=""/>
-      <add key="" value=""/>
-      <add key="" value=""/>
-      <add key="" value=""/>
-      <add key="" value=""/>
-      <add key="" value=""/>
+      <!--调节上限-->
+      <add key="Focus_UP" value="3000"/>
+      <add key="Focus_Down" value="4000"/>
+      <add key="Focus_Step" value="1000"/>
+      <add key="Focus_Range" value="50"/>
+      <add key="Focus_FStep" value="50"/>
     </appSettings>
 </configuration>

+ 59 - 46
HOZProject/FormUnitControl.Designer.cs

@@ -107,6 +107,10 @@
             this.btnMILL = new System.Windows.Forms.Button();
             this.btnFIB = new System.Windows.Forms.Button();
             this.panelSEM = new System.Windows.Forms.Panel();
+            this.button1 = new System.Windows.Forms.Button();
+            this.txtVoltage = new System.Windows.Forms.TextBox();
+            this.button2 = new System.Windows.Forms.Button();
+            this.label67 = new System.Windows.Forms.Label();
             this.btnScanRotationSetOn = new System.Windows.Forms.Button();
             this.btnTiltAngleSetOn = new System.Windows.Forms.Button();
             this.panelFIB = new System.Windows.Forms.Panel();
@@ -289,10 +293,7 @@
             this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
             this.lblPs1 = new System.Windows.Forms.Label();
             this.btnPsFile = new System.Windows.Forms.Button();
-            this.button1 = new System.Windows.Forms.Button();
-            this.txtVoltage = new System.Windows.Forms.TextBox();
-            this.button2 = new System.Windows.Forms.Button();
-            this.label67 = new System.Windows.Forms.Label();
+            this.button3 = new System.Windows.Forms.Button();
             this.panelControl.SuspendLayout();
             this.panelSEM.SuspendLayout();
             this.panelFIB.SuspendLayout();
@@ -1190,6 +1191,50 @@
             this.panelSEM.Size = new System.Drawing.Size(780, 509);
             this.panelSEM.TabIndex = 47;
             // 
+            // button1
+            // 
+            this.button1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.button1.Location = new System.Drawing.Point(693, 365);
+            this.button1.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(54, 34);
+            this.button1.TabIndex = 97;
+            this.button1.Text = "写";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // txtVoltage
+            // 
+            this.txtVoltage.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
+            this.txtVoltage.Location = new System.Drawing.Point(551, 367);
+            this.txtVoltage.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+            this.txtVoltage.Name = "txtVoltage";
+            this.txtVoltage.Size = new System.Drawing.Size(85, 30);
+            this.txtVoltage.TabIndex = 96;
+            this.txtVoltage.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            // 
+            // button2
+            // 
+            this.button2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.button2.Location = new System.Drawing.Point(640, 365);
+            this.button2.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(54, 34);
+            this.button2.TabIndex = 94;
+            this.button2.Text = "读";
+            this.button2.UseVisualStyleBackColor = true;
+            this.button2.Click += new System.EventHandler(this.button2_Click);
+            // 
+            // label67
+            // 
+            this.label67.AutoSize = true;
+            this.label67.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label67.Location = new System.Drawing.Point(469, 369);
+            this.label67.Name = "label67";
+            this.label67.Size = new System.Drawing.Size(72, 27);
+            this.label67.TabIndex = 95;
+            this.label67.Text = "电压:";
+            // 
             // btnScanRotationSetOn
             // 
             this.btnScanRotationSetOn.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -2503,6 +2548,7 @@
             // 
             // tabPage3
             // 
+            this.tabPage3.Controls.Add(this.button3);
             this.tabPage3.Controls.Add(this.cbbWPZD);
             this.tabPage3.Controls.Add(this.cbbWPZF);
             this.tabPage3.Controls.Add(this.cbbWQGD);
@@ -3272,49 +3318,15 @@
             this.btnPsFile.UseVisualStyleBackColor = true;
             this.btnPsFile.Click += new System.EventHandler(this.btnPsFile_Click);
             // 
-            // button1
-            // 
-            this.button1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button1.Location = new System.Drawing.Point(693, 365);
-            this.button1.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
-            this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(54, 34);
-            this.button1.TabIndex = 97;
-            this.button1.Text = "写";
-            this.button1.UseVisualStyleBackColor = true;
-            this.button1.Click += new System.EventHandler(this.button1_Click);
-            // 
-            // txtVoltage
+            // button3
             // 
-            this.txtVoltage.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
-            this.txtVoltage.Location = new System.Drawing.Point(551, 367);
-            this.txtVoltage.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
-            this.txtVoltage.Name = "txtVoltage";
-            this.txtVoltage.Size = new System.Drawing.Size(85, 30);
-            this.txtVoltage.TabIndex = 96;
-            this.txtVoltage.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // button2
-            // 
-            this.button2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button2.Location = new System.Drawing.Point(640, 365);
-            this.button2.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
-            this.button2.Name = "button2";
-            this.button2.Size = new System.Drawing.Size(54, 34);
-            this.button2.TabIndex = 94;
-            this.button2.Text = "读";
-            this.button2.UseVisualStyleBackColor = true;
-            this.button2.Click += new System.EventHandler(this.button2_Click);
-            // 
-            // label67
-            // 
-            this.label67.AutoSize = true;
-            this.label67.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label67.Location = new System.Drawing.Point(469, 369);
-            this.label67.Name = "label67";
-            this.label67.Size = new System.Drawing.Size(72, 27);
-            this.label67.TabIndex = 95;
-            this.label67.Text = "电压:";
+            this.button3.Location = new System.Drawing.Point(120, 149);
+            this.button3.Name = "button3";
+            this.button3.Size = new System.Drawing.Size(132, 93);
+            this.button3.TabIndex = 76;
+            this.button3.Text = "button3";
+            this.button3.UseVisualStyleBackColor = true;
+            this.button3.Click += new System.EventHandler(this.button3_Click);
             // 
             // FormUnitControl
             // 
@@ -3609,6 +3621,7 @@
         private System.Windows.Forms.TextBox txtVoltage;
         private System.Windows.Forms.Button button2;
         private System.Windows.Forms.Label label67;
+        private System.Windows.Forms.Button button3;
     }
 }
 

+ 53 - 3
HOZProject/FormUnitControl.cs

@@ -1322,8 +1322,8 @@ namespace HOZProject
 
         private void btnPost4_Click(object sender, EventArgs e)
         {
-            double offsetx = 0;
-            double offsety = 0;
+            float offsetx = 0;
+            float offsety = 0;
             int state = 0;
             wr.Img_Trapezoid_Top_Center_Position("D:/aaaa.jpg", out offsetx, out offsety, out state);
             lbltopcx.Text = offsetx.ToString("0.0");
@@ -1367,7 +1367,7 @@ namespace HOZProject
         private void btnPost8_Click(object sender, EventArgs e)
         {
             int state = 0;
-            wr.Img_Measure_Size("D:/aaaa.jpg", "1000", "0.005", out state);
+            wr.Img_Measure_Size("D:/aaaa.jpg", 1000, (float)0.005, out state);
             lblstate6.Text = state.ToString();
         }
 
@@ -1686,5 +1686,55 @@ namespace HOZProject
                 iSEM.SetSEMVoltage(set);
             }
         }
+
+        /// 图像拉直算法
+        /// </summary>
+        /// <param name="Slope">倾斜角度</param>
+        /// <param name="x0">圆心坐标x</param>
+        /// <param name="y0">圆心坐标y</param>
+        /// <param name="x1">倾斜情况下帧图的坐标x</param>
+        /// <param name="y1">倾斜情况下帧图的坐标y</param>
+        /// <param name="Hx">复位到原位置需要移动的x值(返回值)</param>
+        /// <param name="Hy">复位到原位置需要移动的y值(返回值)</param>
+        /// <returns></returns>
+        public bool Straightening(float Slope, float x0, float y0, float x1, float y1, ref float Hx, ref float Hy)
+        {
+            try
+            {
+                double xr = x1 - x0;//倾斜图到中心的距离差x
+                double yr = y1 - y0;//倾斜图到中心的距离差y
+                double R = Math.Sqrt(xr * xr + yr * yr);//圆心到倾斜图的长度
+                //double D = 2 * R * Math.Sin(ScanRotation / 2);//倾斜图与矫正图底边的长度
+                double k = Math.Atan(y1 / x1) / Math.PI * 180;//x1,y1的直角三角形圆心角度
+                double k_S = k - Slope;//通过夹角差求x2,y2
+                int y2 = (int)Math.Round(Math.Sin(Math.PI / (180 / k_S)) * R);
+                int x2 = (int)Math.Round(Math.Cos(Math.PI / (180 / k_S)) * R);
+
+                if (Slope > 0 || Slope < 0)
+                {
+                    Hx = x1 - x2;
+                    Hy = y1 - y2;
+                }
+                else
+                {
+                    Hx = 0;
+                    Hy = 0;
+                }
+
+                return true;
+            }
+            catch (Exception)
+            {
+                return false;
+            }
+        }
+
+
+        private void button3_Click(object sender, EventArgs e)
+        {
+            float x1 = 0, y1 = 0;
+            Straightening(5, 65, 65, (float)59.016, (float)58.837, ref x1, ref y1);
+            button3.Text = x1.ToString("0.00") + "\n" + y1.ToString("0.00");
+        }
     }
 }

+ 2 - 2
HOZProject/Program.cs

@@ -17,9 +17,9 @@ namespace HOZProject
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             //Application.Run(new FormUCMain());
-            Application.Run(new FormHOZMain());
+            //Application.Run(new FormHOZMain());
             //Application.Run(new FormMeasureTest());
-            //Application.Run(new FormUnitControl());
+            Application.Run(new FormUnitControl());
         }
     }
 }

+ 1 - 1
ManulDo/MainForm.cs

@@ -59,7 +59,7 @@ namespace WindowsFormsApp1
         #region 测量线程
         void DoWork(object sender, DoWorkEventArgs e)
         {
-            m_Ms = new Measure();
+            m_Ms = new Measure("","","");
             m_Ms.InitMeas(m_MeasureFile);
             m_Ms.SendThreadStatus += new ThreadStatusHandler(displayMessage); //注册事件
 

文件差异内容过多而无法显示
+ 456 - 247
MeasureThread/Measure.cs


+ 4 - 4
WebManager/WebResult.cs

@@ -215,7 +215,7 @@ namespace WebManager
         /// </summary>
         /// <param name="imagePath">图片路径</param>
         /// <returns>json字符串</returns>
-        public void Img_Trapezoid_Top_Center_Position(String imagePath, out double offsetx, out double offsety, out int state)
+        public void Img_Trapezoid_Top_Center_Position(String imagePath, out float offsetx, out float offsety, out int state)
         {
             try
             {
@@ -234,8 +234,8 @@ namespace WebManager
             {
                 JObject jname = JObject.Parse(jret["img_name"].ToString());
                 JArray jlocation = JArray.Parse(jname["top_center"].ToString());
-                offsetx = Convert.ToDouble(jlocation[0].ToString());
-                offsety = Convert.ToDouble(jlocation[1].ToString());
+                offsetx = Convert.ToSingle(jlocation[0].ToString());
+                offsety = Convert.ToSingle(jlocation[1].ToString());
                 state = Convert.ToInt32(jname["state"].ToString());
             }
             else
@@ -362,7 +362,7 @@ namespace WebManager
         /// <param name="ratio">放大倍数</param>
         /// <param name="size">一像素代表**mm/um</param>
         /// <returns>json字符串</returns>
-        public void Img_Measure_Size(String imagePath, String ratio, String size, out int state)
+        public void Img_Measure_Size(String imagePath, float ratio, float size, out int state)
         {
             try
             {

部分文件因为文件数量过多而无法显示