瀏覽代碼

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

wb_han 5 年之前
父節點
當前提交
ce1851dd93
共有 1 個文件被更改,包括 44 次插入1 次删除
  1. 44 1
      MeasureThread/Measure.cs

+ 44 - 1
MeasureThread/Measure.cs

@@ -358,6 +358,49 @@ namespace MeasureThread
 
 
     public class Measure
     public class Measure
     {
     {
+        /// <summary>
+        /// 图像拉直算法
+        /// </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(double Slope, int x0, int y0, int x1, int y1, ref int Hx, ref int 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;
+            }
+        }
+
         public event ThreadStatusHandler SendThreadStatus;  // 声明事件
         public event ThreadStatusHandler SendThreadStatus;  // 声明事件
         public event CutHolesStatusHandler SendCutHolesStatus;  // 声明事件
         public event CutHolesStatusHandler SendCutHolesStatus;  // 声明事件
 
 
@@ -730,7 +773,7 @@ namespace MeasureThread
                 {
                 {
                     return false;
                     return false;
                 }
                 }
-                arg.Message = "放大600倍";
+                arg.Message = "放大" + m_measureFile.MParam.Photograph_Magnification.ToString("0.0") + "倍";
                 SendMsg("1-1");
                 SendMsg("1-1");
 
 
                 //2.控制SEM自动对焦、亮度、对比度
                 //2.控制SEM自动对焦、亮度、对比度