Snowaterr пре 1 година
родитељ
комит
dd873bca3a

+ 70 - 34
Assets/WebCamera/Script/ZIM/InfraredLocate/InfraredLocate.cs

@@ -28,7 +28,7 @@ namespace ZIM
         Match1 = 2
     }
 
-    // 支持2个红外点的识别
+    // 鏀�寔2涓�孩澶栫偣鐨勮瘑鍒�
     public class InfraredLocate
     {
         public static object locker = new object();
@@ -48,8 +48,8 @@ namespace ZIM
             return positions;
         }
 
-        readonly int samplingScale = 2;
-        readonly float[] spotBrightness = new float[] { 0.93f, 0.5f };      // 亮点阈值
+        readonly float[] spotBrightness = new float[] { 0.93f, 0.5f };      // 浜�偣闃堝€�
+        readonly int samplingScale = 1;
         //const float circleVariance = 30f;
         //const int brightAreaRadius = 30; 
         //const int LeastBrightPoint = 10000;
@@ -72,11 +72,19 @@ namespace ZIM
             }
         }
 
+        // 鍙傛暟鏄� 绾㈠�鐏�殑浜�害闃堝€硷紝闃堝€艰秺灏忚兘澶熸�娴嬪埌鐨勪寒搴﹀氨瓒婁綆
+        public void SetBrightnessThreshold(float brightnessThreshold = 0.93f)
+        {
+            spotBrightness[0] = brightnessThreshold; spotBrightness[1] = (float)Math.Min(Math.Exp(1.5 * brightnessThreshold - 1.8), brightnessThreshold);       // 鍛ㄥ洿娉涘厜鐨勪寒搴︾敤鎸囨暟鍑芥暟鐩存帴绠�
+        }
+
         public InfraredLocate(Serenegiant.UVC.UVCManager.CameraInfo cameraInfo, ScreenIdentification infraredIdentification, InfraredSpotSettings infraredSpotSettings)
         {
             this.mCameraInfo = cameraInfo;
             this.screenIdentification = infraredIdentification;
             this.infraredSpotSettings = infraredSpotSettings;
+
+            //samplingScale = 2;
         }
 
         readonly int CheakFrame = 10;
@@ -87,21 +95,17 @@ namespace ZIM
         public InfraredSpot[] UpdateSingle(Color[] cameraPixels)
         {
             var spotArea = LocateToScreen(cameraPixels, screenIdentification.Screen.QuadRect);
-            if (spotArea.Count > 0)
-            {
-                InfraredSpots[0].Update(spotArea.Max((a, b) => a.Radius.CompareTo(b.Radius)));
-            }
-            return InfraredSpots;
+            return MatchInfraredRaySingle(spotArea);
         }
 
-        // New, 通过透视映射计算红外点的相对位置, 返回的红外点根据半径 从大到小排序
+        // New, 閫氳繃閫忚�鏄犲皠璁$畻绾㈠�鐐圭殑鐩稿�浣嶇疆, 杩斿洖鐨勭孩澶栫偣鏍规嵁鍗婂緞 浠庡ぇ鍒板皬鎺掑簭
         public InfraredSpot[] Update(Color[] cameraPixels)
         {
             var spotArea = LocateToScreen(cameraPixels, screenIdentification.Screen.QuadRect);
             return MatchInfraredRay(spotArea);
         }
 
-        // New, 返回由大到小排序的点
+        // New, 杩斿洖鐢卞ぇ鍒板皬鎺掑簭鐨勭偣
         public List<PixelSpotArea> LocateToScreen(Color[] pixels, Rect rect)
         {
             if (InfraredSpots == null)
@@ -115,7 +119,7 @@ namespace ZIM
             //watch.Start();
             //var times = new List<double>() { 0.0 };
 
-            /* 根据亮点情况调整samplingScale
+            /* 鏍规嵁浜�偣鎯呭喌璋冩暣samplingScale
 
             (int x, int y) rectMin = ((int)rect.min.x / samplingScale, (int)rect.min.y / samplingScale);
             (int x, int y) rectMax = ((int)rect.max.x / samplingScale, (int)rect.max.y / samplingScale);
@@ -140,14 +144,14 @@ namespace ZIM
             });
             if (brightCount > 1000)
             {
-                samplingScale = (int)Math.Ceiling(samplingScale * Math.Sqrt(brightCount / 1000.0));       // 如果亮点太多,控制亮点数量在1000左右
+                samplingScale = (int)Math.Ceiling(samplingScale * Math.Sqrt(brightCount / 1000.0));       // 濡傛灉浜�偣澶��锛屾帶鍒朵寒鐐规暟閲忓湪1000宸﹀彸
             }
             /**/
 
             (int x, int y) rectMin = ((int)rect.min.x / samplingScale, (int)rect.min.y / samplingScale);
             (int x, int y) rectMax = ((int)rect.max.x / samplingScale, (int)rect.max.y / samplingScale);
 
-            var spotPoint = new List<Vector2>((int)rect.width * (int)rect.height / 256);     // 预估的初始容量
+            var spotPoint = new List<Vector2>((int)rect.width * (int)rect.height / 256);     // 棰勪及鐨勫垵濮嬪�閲�
             var brightPoint = new List<Vector2>((int)rect.width * (int)rect.height / 64);
 
             Parallel.For(rectMin.x, rectMax.x, (i) =>
@@ -183,7 +187,7 @@ namespace ZIM
             //times.Add(watch.ElapsedMilliseconds);
             //UnityEngine.Debug.Log("time1: " + (times[times.Count - 1] - times[times.Count - 2]));
 
-            // 所有点映射到屏幕空间
+            // 鎵€鏈夌偣鏄犲皠鍒板睆骞曠┖闂�
             Parallel.For(0, spotPoint.Count, (i) => spotPoint[i] = screenIdentification.Screen.TransformToScreen(spotPoint[i]));
             Parallel.For(0, brightPoint.Count, (i) => brightPoint[i] = screenIdentification.Screen.TransformToScreen(brightPoint[i]));
 
@@ -224,7 +228,7 @@ namespace ZIM
                 if (spotArea.Count == 0)
                     return spotArea;
 
-                // 亮度较低的部分合并到区域中
+                // 浜�害杈冧綆鐨勯儴鍒嗗悎骞跺埌鍖哄煙涓�
                 for (int i = 0; i < brightPoint.Count; i++)
                 {
                     var p = brightPoint[i];
@@ -244,7 +248,7 @@ namespace ZIM
 
                 return spotArea;
 
-                //半径再按透视修正一遍,降低一点常规角度下反射的影响
+                //鍗婂緞鍐嶆寜閫忚�淇��涓€閬嶏紝闄嶄綆涓€鐐瑰父瑙勮�搴︿笅鍙嶅皠鐨勫奖鍝�
                 foreach (var i in spotArea)
                 {
                     var r0 = i.Radius / 2 / mCameraInfo.CurrentWidth;
@@ -257,7 +261,7 @@ namespace ZIM
                         (screenIdentification.Screen.TransformToScreen(offset3) - screenIdentification.Screen.TransformToScreen(offset4)).magnitude) / 4;
                     var r1 = transR / screenIdentification.Screen.UVSize.x;
                     //Debug.Log(r1 / r0);
-                    i.Radius *= (float)Math.Pow(r1 / r0, 2);      // 摄像机位置不同参数也可能不同
+                    i.Radius *= (float)Math.Pow(r1 / r0, 2);      // 鎽勫儚鏈轰綅缃�笉鍚屽弬鏁颁篃鍙�兘涓嶅悓
                 }
 
                 //if (spotArea.Count == 1)
@@ -265,7 +269,7 @@ namespace ZIM
 
                 return spotArea;
 
-                //// 排序亮区
+                //// 鎺掑簭浜�尯
                 //spotArea.Sort((a, b) => b.MaxRadius.CompareTo(a.MaxRadius));
                 ////var areas = new SortedList<float, PixelSpotArea>(new DescendingComparer<float>());
                 ////foreach (var i in spotArea)
@@ -284,7 +288,7 @@ namespace ZIM
             return new List<PixelSpotArea>();
         }
 
-        public List<Vector2> GetOld(int[] brightness)        // 取整后的亮度图
+        public List<Vector2> GetOld(int[] brightness)        // 鍙栨暣鍚庣殑浜�害鍥�
         {
             return LocateOld(brightness, new Rect(0, 0, mCameraInfo.CurrentWidth, mCameraInfo.CurrentHeight));
         }
@@ -334,7 +338,7 @@ namespace ZIM
 
             if (brightPixelDic.Count > 0)
             {
-                // 取亮度最高的像素
+                // 鍙栦寒搴︽渶楂樼殑鍍忕礌
                 var keys = brightPixelDic.Keys.ToList();
                 var maxIndex = o0.o0.MaxIndex(keys);
                 //keys.Sort((a, b) => -a.CompareTo(b));
@@ -381,7 +385,7 @@ namespace ZIM
                     //foreach (var j in brightArea)
                     //{
                     //    var offset = (p - j.Center);
-                    //    if (offset.magnitude < brightAreaRadius)     // 距离近的并入该区域
+                    //    if (offset.magnitude < brightAreaRadius)     // 璺濈�杩戠殑骞跺叆璇ュ尯鍩�
                     //    {
                     //        j.Pixels.Add(p);
                     //        j.Center += offset / j.Pixels.Count;
@@ -448,6 +452,38 @@ namespace ZIM
             return null;
         }
 
+        InfraredSpot[] MatchInfraredRaySingle(List<PixelSpotArea> spotArea)
+        {
+            var matchedArea = new Dictionary<InfraredMatch, PixelSpotArea>() { { InfraredMatch.Match0, null } };
+            var v0 = InfraredSpots[0].Verify(spotArea, matchedArea);
+
+            if (v0)
+            {
+                // 姣忛殧20甯ф�鏌ュ紓甯�
+                //if (++cheakCounter >= CheakFrame)
+                //{
+                //    var maxArea = spotArea.Max((a, b) => a.Radius.CompareTo(b.Radius));
+                //    cheakCounter = 0;
+                //    if (matchedArea[InfraredMatch.Match0] != maxArea)
+                //    {
+                //        InfraredSpots[0].Reset();       // 闃叉�寮傚父
+                //    }
+                //}
+            }
+            else
+            {
+                if (spotArea.Count > 0)
+                {
+                    matchedArea[InfraredMatch.Match0] = spotArea.Max((a, b) => a.Radius.CompareTo(b.Radius));
+                }
+            }
+
+            foreach (var i in matchedArea)
+                GetSpot(i.Key).Update(i.Value);
+
+            return InfraredSpots;
+        }
+
         InfraredSpot[] MatchInfraredRay(List<PixelSpotArea> spotArea)
         {
             var matchedArea = new Dictionary<InfraredMatch, PixelSpotArea>() { { InfraredMatch.Match0, null }, { InfraredMatch.Match1, null } };
@@ -459,7 +495,7 @@ namespace ZIM
                 if (!v0 && !v1)
                 {
                     //Application.targetFrameRate = 1;
-                    //Debug.Log($"{Time.time}全失败 spotArea {spotArea.Count}");
+                    //Debug.Log($"{Time.time}鍏ㄥけ璐� spotArea {spotArea.Count}");
                     if (spotArea.Count == 0)
                     {
                         //InfraredSpots[0].UpdateByPredict();
@@ -491,7 +527,7 @@ namespace ZIM
                     }
                     else
                     {
-                        spotArea.Sort((a, b) => b.Radius.CompareTo(a.Radius));                    // 排序亮区
+                        spotArea.Sort((a, b) => b.Radius.CompareTo(a.Radius));                    // 鎺掑簭浜�尯
                         matchedArea[InfraredMatch.Match0] = spotArea[0];
                         matchedArea[InfraredMatch.Match1] = spotArea[1];
                     }
@@ -516,8 +552,8 @@ namespace ZIM
 
                     if (oneFailed != InfraredMatch.Nomatch)
                     {
-                        //Debug.LogWarning($"{Time.time}成功1个 {oneFailed}");
-                        spotArea.Sort((a, b) => b.Radius.CompareTo(a.Radius));                        // 排序亮区
+                        //Debug.LogWarning($"{Time.time}鎴愬姛1涓� {oneFailed}");
+                        spotArea.Sort((a, b) => b.Radius.CompareTo(a.Radius));                        // 鎺掑簭浜�尯
                         foreach (var i in spotArea)
                         {
                             if (i != select)
@@ -538,10 +574,10 @@ namespace ZIM
                     }
                     else
                     {
-                        //Debug.LogWarning($"{Time.time}成功2个");
+                        //Debug.LogWarning($"{Time.time}鎴愬姛2涓�");
                         if (matchedArea[InfraredMatch.Match0] == matchedArea[InfraredMatch.Match1])
                         {
-                            // 重叠
+                            // 閲嶅彔
                             Infrared12Overlap = true;
                             //if (spotArea.Count == 1)
                             //{
@@ -554,7 +590,7 @@ namespace ZIM
                             //else
                             //{
                             //    Infrared12Overlap = false;
-                            //    spotArea.Sort((a, b) => b.Radius.CompareTo(a.Radius));                    // 排序亮区
+                            //    spotArea.Sort((a, b) => b.Radius.CompareTo(a.Radius));                    // 鎺掑簭浜�尯
                             //    InfraredSpots[0].Update(spotArea[0]);
                             //    InfraredSpots[1].Update(spotArea[1]);
                             //}
@@ -565,17 +601,17 @@ namespace ZIM
                             //InfraredSpots[0].Update(matchedArea[InfraredMatch.Match0]);
                             //InfraredSpots[1].Update(matchedArea[InfraredMatch.Match1]);
 
-                            // 每隔20帧更新阈值
+                            // 姣忛殧20甯ф洿鏂伴槇鍊�
                             if (++cheakCounter >= CheakFrame)
                             {
-                                //Debug.Log($"{Time.time}更新阈值2个");
+                                //Debug.Log($"{Time.time}鏇存柊闃堝€�2涓�");
                                 var middle = (matchedArea[InfraredMatch.Match0].Radius + matchedArea[InfraredMatch.Match1].Radius) / 2;
                                 infraredSpotSettings.UpdateThreshold(middle);
                                 cheakCounter = 0;
                                 if (matchedArea[InfraredMatch.Match0].Radius < middle)
                                 {
-                                    //Debug.Log($"{Time.time}大小异常");
-                                    InfraredSpots[0].Reset();       // 防止异常
+                                    //Debug.Log($"{Time.time}澶у皬寮傚父");
+                                    InfraredSpots[0].Reset();       // 闃叉�寮傚父
                                     InfraredSpots[1].Reset();
                                 }
                             }
@@ -650,7 +686,7 @@ namespace ZIM
             return InfraredSpots;
         }
 
-        // 亮度图是64位整形,返回卷积后的均值是float
+        // 浜�害鍥炬槸64浣嶆暣褰�紝杩斿洖鍗风Н鍚庣殑鍧囧€兼槸float
         float ConvBrightness(int[] pixels, (int x, int y) point, int kernel_size = 3)
         {
             var sum = 0f;
@@ -659,7 +695,7 @@ namespace ZIM
                 for (int j = point.y - kernel_size / 2; j <= point.y + kernel_size / 2; j++)
                 {
                     var index = mCameraInfo.CoordToIndex(i, j);
-                    if (index > 0 && index < pixels.Length)       // 超出边缘不计算
+                    if (index > 0 && index < pixels.Length)       // 瓒呭嚭杈圭紭涓嶈�绠�
                         sum += pixels[index];
                 }
             }

+ 6 - 2
Assets/WebCamera/Script/ZIM/InfraredLocate/InfraredSpot/PixelSpotArea.cs

@@ -9,10 +9,14 @@ using Color = UnityEngine.Color;
 
 namespace ZIM
 {
+    // 亮区的点用来定位(计算center),泛光区域的点用来计算radius
     public class PixelSpotArea
     {
-        public static int gridLength0 = 6;      // 亮区
-        public static int gridLength1 = 20;     // 边缘泛光
+        //public static float gridRatio0 = 6f / 1280;
+        //public static float gridRatio1 = 20f / 720;
+
+        public static int gridLength0 = 2;      // 亮区
+        public static int gridLength1 = 10;     // 边缘泛光
 
         public static (int x, int y) GetGrid0(Vector2 v)
         {

+ 44 - 44
Assets/WebCamera/Script/ZIM/ScreenLocate.cs

@@ -33,7 +33,7 @@ public class ScreenLocate : MonoBehaviour
     }
     Platform mPlatform = Platform.Android;
 
-    // 2个灯,顺序根据红外灯的大小 由大到小, 坐标通过 InfraredSpot.ScreenUV 和 InfraredSpot.CameraLocation 获得
+    // 2涓�伅锛岄『搴忔牴鎹�孩澶栫伅鐨勫ぇ灏� 鐢卞ぇ鍒板皬锛� 鍧愭爣閫氳繃 InfraredSpot.ScreenUV 鍜� InfraredSpot.CameraLocation 鑾峰緱
     public InfraredSpot[] InfraredSpots
     {
         get
@@ -42,7 +42,7 @@ public class ScreenLocate : MonoBehaviour
             return infraredSpotBuffer;
         }
     }
-    // 1个灯, 坐标通过 InfraredSpot.ScreenUV 和 InfraredSpot.CameraLocation 获得
+    // 1涓�伅, 鍧愭爣閫氳繃 InfraredSpot.ScreenUV 鍜� InfraredSpot.CameraLocation 鑾峰緱
     public InfraredSpot InfraredSpotSingle
     {
         get
@@ -54,7 +54,7 @@ public class ScreenLocate : MonoBehaviour
     InfraredSpot[] infraredSpotBuffer;
     InfraredCount infraredCount;
 
-    #region UVC 处理的对象
+    #region UVC 澶勭悊鐨勫�璞�
     public UVCManager mUVCManager;
     public UVCDrawer mUVCDrawer;
     public CameraInfo mUVCCameraInfo;
@@ -92,16 +92,16 @@ public class ScreenLocate : MonoBehaviour
     public InfraredManager.UIManagerSingle mUIManagerSingle;
     // private SynchronizationContext mainContext;
 
-    //是否单点显示
-    bool bSinglePoint = true;//默认单点识别
+    //鏄�惁鍗曠偣鏄剧ず
+    bool bSinglePoint = true;//榛樿�鍗曠偣璇嗗埆
     public Toggle SinglePointToggle;
-    bool bIdentifyRed = true;//默认设备红色
+    bool bIdentifyRed = true;//榛樿�璁惧�绾㈣壊
     public Toggle SinglePointToggleColor;
 
     bool bIdentifyGreen = true;
     public Toggle SinglePointToggleColorGreen;
 
-    #region 性能检测相关
+    #region 鎬ц兘妫€娴嬬浉鍏�
     public Text m_UITime;
     const float m_UIUpdateInterval = 0.1f;
     float m_UIUpdateTimer = 0.0f;
@@ -209,7 +209,7 @@ public class ScreenLocate : MonoBehaviour
 
         if (SinglePointToggle)
         {
-            //如果是单点显示
+            //濡傛灉鏄�崟鐐规樉绀�
             bSinglePoint = PlayerPrefs.GetInt("bSinglePoint", 1) == 1;
             SinglePointToggle.isOn = bSinglePoint;
         }
@@ -224,7 +224,7 @@ public class ScreenLocate : MonoBehaviour
             SinglePointToggleColorGreen.isOn = bIdentifyGreen;
         }
 
-        #region 性能检测相关
+        #region 鎬ц兘妫€娴嬬浉鍏�
         for (var i = 0; i < m_History.Capacity; ++i)
         {
             m_History.Add(0.0f);
@@ -233,7 +233,7 @@ public class ScreenLocate : MonoBehaviour
         frames = 0;
         #endregion
     }
-    //ZIMWebCamera场景使用
+    //ZIMWebCamera鍦烘櫙浣跨敤
     public void WebCamIsReady(Texture texture)
     {
         mPlatform = Platform.Window;
@@ -241,7 +241,7 @@ public class ScreenLocate : MonoBehaviour
         mUVCCameraInfo = new CameraInfo(mUVCTexture);
         brightness = 0;
     }
-    //手机端UVCCamra使用
+    //鎵嬫満绔疷VCCamra浣跨敤
     public void UVCIsReady(Texture texture)
     {
         mPlatform = Platform.Android;
@@ -328,11 +328,11 @@ public class ScreenLocate : MonoBehaviour
                 obj.transform.localPosition = new Vector2(u, v).pixelToLocalPosition_AnchorCenter(new Vector2(1, 1), FullScreenImage.rectTransform.rect);
 
                 if (pointManual.Count == 1)
-                    Info.text = "左键单击屏幕 右下角";
+                    Info.text = "宸﹂敭鍗曞嚮灞忓箷 鍙充笅瑙�";
                 else if (pointManual.Count == 2)
-                    Info.text = "左键单击屏幕 右上角";
+                    Info.text = "宸﹂敭鍗曞嚮灞忓箷 鍙充笂瑙�";
                 else if (pointManual.Count == 3)
-                    Info.text = "左键单击屏幕 左上角";
+                    Info.text = "宸﹂敭鍗曞嚮灞忓箷 宸︿笂瑙�";
                 else if (pointManual.Count == 4)
                 {
                     screenIdentification.LocateScreenManual(new OrdinalQuadrilateral(pointManual[0].o0Vector(), pointManual[1].o0Vector(), pointManual[3].o0Vector(), pointManual[2].o0Vector()));
@@ -349,7 +349,7 @@ public class ScreenLocate : MonoBehaviour
         var t0 = Time.realtimeSinceStartup;
 
         /* New*/
-        if (mUVCCameraInfo != null && mUVCCameraInfo.IsPreviewing && screenIdentification.Screen.Active)     // 成功定位屏幕后才做红外识别
+        if (mUVCCameraInfo != null && mUVCCameraInfo.IsPreviewing && screenIdentification.Screen.Active)     // 鎴愬姛瀹氫綅灞忓箷鍚庢墠鍋氱孩澶栬瘑鍒�
         {
           
             CreateUVCTexture2DIfNeeded();
@@ -358,20 +358,20 @@ public class ScreenLocate : MonoBehaviour
                 if (mode == Mode.InfraredLocate)
                 {
                     //0,0, cameraTexture2D.width, cameraTexture2D.height,0
-                    var pixels = mUVCTexture2D.GetPixels();       // 从左往右、从下往上
+                    var pixels = mUVCTexture2D.GetPixels();       // 浠庡乏寰€鍙炽€佷粠涓嬪線涓�
                     //InfraredSpots = infraredLocate.Update(pixels);
                     if (bSinglePoint)
                         infraredSpotBuffer = infraredLocate.UpdateSingle(pixels);
                     else
                         infraredSpotBuffer = infraredLocate.Update(pixels);
 
-                    if (mPlatform == Platform.Window || mUIManagerSingle.bGetPanelActive) //渲染ui上面的点。进入游戏可以隐藏
+                    if (mPlatform == Platform.Window || mUIManagerSingle.bGetPanelActive) //娓叉煋ui涓婇潰鐨勭偣銆傝繘鍏ユ父鎴忓彲浠ラ殣钘�
                     {
                         for (int i = 0; i < infraredSpotBuffer.Length; i++)
                         {
                             if (infraredSpotBuffer[i].CameraLocation != null)
                             {
-                                // 检测到光点
+                                // 妫€娴嬪埌鍏夌偣
                                 var posInCanvas = infraredSpotBuffer[i].CameraLocation.Value.pixelToLocalPosition_AnchorCenter(mUVCCameraInfo.Size, rawImage.rectTransform.rect);
                                 CrosshairInCamera[i].gameObject.SetActive(true);
                                 CrosshairInCamera[i].anchoredPosition = posInCanvas;
@@ -382,15 +382,15 @@ public class ScreenLocate : MonoBehaviour
                         }
                     }
 
-                    //手机端使用
+                    //鎵嬫満绔�娇鐢�
                     if (mPlatform == Platform.Android && infraredSpotBuffer.Length > 0)
                     {
                         int redIndex = 0;
                         int greenIndex = 1;
-                        //仅仅第一个点显示(如果最大点出界了会闪烁)
+                        //浠呬粎绗�竴涓�偣鏄剧ず(濡傛灉鏈€澶х偣鍑虹晫浜嗕細闂�儊)
                         if (bSinglePoint)
                         {
-                            redIndex = 0; //单点识别是,可以选择切换颜色
+                            redIndex = 0; //鍗曠偣璇嗗埆鏄�紝鍙�互閫夋嫨鍒囨崲棰滆壊
                             if (infraredSpotBuffer[redIndex].ScreenUV != null)
                             {
                                 string str = "Single:";
@@ -402,7 +402,7 @@ public class ScreenLocate : MonoBehaviour
                         }
                         else
                         {
-                            //雙點模式下選擇第一個點
+                            //闆欓粸妯″紡涓嬮伕鎿囩�涓€鍊嬮粸
                             if (bIdentifyRed && !bIdentifyGreen)
                             {
                                 if (infraredSpotBuffer[redIndex].ScreenUV != null)
@@ -413,7 +413,7 @@ public class ScreenLocate : MonoBehaviour
                                 }
                                 else
                                 {
-                                    Info.text = "未检测到红色最大点!";
+                                    Info.text = "鏈��娴嬪埌绾㈣壊鏈€澶х偣锛�";
                                 }
                             }
                             else if (!bIdentifyRed && bIdentifyGreen) {
@@ -426,13 +426,13 @@ public class ScreenLocate : MonoBehaviour
                                 }
                                 else
                                 {
-                                    Info.text = "未检测到绿色点!";
+                                    Info.text = "鏈��娴嬪埌缁胯壊鐐癸紒";
                                 }
                             }
                             else
                             {
-                                //两个不选择和两个全选都跑识别两个点
-                                //自動切換 检测到光点
+                                //涓や釜涓嶉€夋嫨鍜屼袱涓�叏閫夐兘璺戣瘑鍒�袱涓�偣
+                                //鑷�嫊鍒囨彌 妫€娴嬪埌鍏夌偣
                                 if (infraredSpotBuffer[redIndex].ScreenUV != null)
                                 {
                                     Info.text = "Red:" + infraredSpotBuffer[redIndex].ScreenUV.Value.ToString("F4");
@@ -448,7 +448,7 @@ public class ScreenLocate : MonoBehaviour
                                 }
                                 else
                                 {
-                                    Info.text = "未检测到点!";
+                                    Info.text = "鏈��娴嬪埌鐐癸紒";
                                 }
 
                             }
@@ -509,7 +509,7 @@ public class ScreenLocate : MonoBehaviour
                 }
 
             }
-            var statistics = $"{m_History.Count} 帧样本:\naverage: {m_AverageTime * 1000.0f:F2}ms\nmedian: {m_MedianTime * 1000.0f:F2}ms\nmin: {m_MinTime * 1000.0f:F2}ms\nmax: {m_MaxTime * 1000.0f:F2}ms\n";
+            var statistics = $"{m_History.Count} 甯ф牱鏈�:\naverage: {m_AverageTime * 1000.0f:F2}ms\nmedian: {m_MedianTime * 1000.0f:F2}ms\nmin: {m_MinTime * 1000.0f:F2}ms\nmax: {m_MaxTime * 1000.0f:F2}ms\n";
 
             //Method: {m_Method} {UnityEngine.SceneManagement.SceneManager.GetActiveScene().name} |
             if (m_UITime != null)
@@ -548,21 +548,21 @@ public class ScreenLocate : MonoBehaviour
         ToMode(Mode.ScreenMap);
     }
 
-    //进入手动定位屏幕
+    //杩涘叆鎵嬪姩瀹氫綅灞忓箷
     public void BtnScreenLocateManual()
     {
         ToMode(Mode.ScreenLocateManual);
     }
 
-    // 标记屏幕的四个角
+    // 鏍囪�灞忓箷鐨勫洓涓��
     public void ShowScreen(OrdinalQuadrilateral quad)
     {
         if (quad == null)
         {
-            Info.text = "识别屏幕失败";
+            Info.text = "璇嗗埆灞忓箷澶辫触";
             return;
         }
-        Info.text = "已识别到屏幕";
+        Info.text = "宸茶瘑鍒�埌灞忓箷";
 
         if (ShowScreenQuad)
         {
@@ -586,18 +586,18 @@ public class ScreenLocate : MonoBehaviour
         {
             if (!screenIdentification.Screen.Active)
             {
-                Info.text = "先定位屏幕";
+                Info.text = "鍏堝畾浣嶅睆骞�";
                 return;
             }
-            Info.text = "按ESC退出";
+            Info.text = "鎸塃SC閫€鍑�";
             SetScreen(Color.black);
             Info.transform.SetAsLastSibling();
             this.mode = Mode.ScreenMap;
         }
         else if (mode == Mode.InfraredLocate)
         {
-            Info.text = screenIdentification.Screen.Active ? "已定位屏幕" : "定位屏幕失败";
-            //Info.text = "已识别到屏幕"; 
+            Info.text = screenIdentification.Screen.Active ? "宸插畾浣嶅睆骞�" : "瀹氫綅灞忓箷澶辫触";
+            //Info.text = "宸茶瘑鍒�埌灞忓箷"; 
             SetScreen(null);
             foreach (var i in CrosshairInScreen)
                 i.gameObject.SetActive(false);
@@ -609,12 +609,12 @@ public class ScreenLocate : MonoBehaviour
             // rawImage1.texture = null;
 
 #if (!NDEBUG && DEBUG && ENABLE_LOG)
-            Console.WriteLine($"{TAG} Mode.InfraredLocate:已识别到屏幕:{ screenIdentification.Screen.Active}");
+            Console.WriteLine($"{TAG} Mode.InfraredLocate:宸茶瘑鍒�埌灞忓箷:{ screenIdentification.Screen.Active}");
 #endif
         }
         else if (mode == Mode.ScreenLocateManual)
         {
-            Info.text = "左键单击屏幕 左下角";
+            Info.text = "宸﹂敭鍗曞嚮灞忓箷 宸︿笅瑙�";
             FullScreenImage.gameObject.SetActive(true);
             Info.transform.SetSiblingIndex(transform.childCount - 1);
 
@@ -664,14 +664,14 @@ public class ScreenLocate : MonoBehaviour
 
     private void Press()
     {
-        Debug.Log("进入手动定位");
+        Debug.Log("杩涘叆鎵嬪姩瀹氫綅");
         BtnScreenLocateManual();
         resetTime();
     }
 
     public void OnDoubleClick()
     {
-        //超时重置
+        //瓒呮椂閲嶇疆
         if (!m_firstTime.Equals(default(DateTime)))
         {
             var intervalTime = DateTime.Now - m_firstTime;
@@ -680,13 +680,13 @@ public class ScreenLocate : MonoBehaviour
                 resetTime();
         }
 
-        // 按下按钮时对两次的时间进行记录
+        // 鎸変笅鎸夐挳鏃跺�涓ゆ�鐨勬椂闂磋繘琛岃�褰�
         if (m_firstTime.Equals(default(DateTime)))
             m_firstTime = DateTime.Now;
         else
             m_secondTime = DateTime.Now;
 
-        // 在第二次点击触发,时差小于400ms触发
+        // 鍦ㄧ�浜屾�鐐瑰嚮瑙﹀彂,鏃跺樊灏忎簬400ms瑙﹀彂
         if (!m_firstTime.Equals(default(DateTime)) && !m_secondTime.Equals(default(DateTime)))
         {
             var intervalTime = m_secondTime - m_firstTime;
@@ -706,7 +706,7 @@ public class ScreenLocate : MonoBehaviour
     #endregion
 
 
-    #region 性能检测相关
+    #region 鎬ц兘妫€娴嬬浉鍏�
     void InvalidateTimings()
     {
         m_ValidHistoryFrames = 0;
@@ -718,7 +718,7 @@ public class ScreenLocate : MonoBehaviour
     void UpdateInputs()
     {
         
-        //重置
+        //閲嶇疆
         if (Input.GetKeyDown(KeyCode.UpArrow))
         {
             InvalidateTimings();