瀏覽代碼

改回2张图(原图、色差)识别

ZIM 1 年之前
父節點
當前提交
f77fa81b5c
共有 1 個文件被更改,包括 13 次插入12 次删除
  1. 13 12
      Assets/InfraredProject/WebCamera/Script/ZIM/InfraredLocate/ScreenIdentification.cs

+ 13 - 12
Assets/InfraredProject/WebCamera/Script/ZIM/InfraredLocate/ScreenIdentification.cs

@@ -70,10 +70,11 @@ namespace o0.Project
         {
             return i switch
             {
-                1 => UnityEngine.Color.green,
-                2 => UnityEngine.Color.red,
-                3 => UnityEngine.Color.yellow,
+                1 => UnityEngine.Color.yellow,
+                2 => new UnityEngine.Color(0,1,1,1),
+                3 => UnityEngine.Color.green,
                 4 => UnityEngine.Color.white,
+                5 => UnityEngine.Color.red,
                 _ => UnityEngine.Color.black,
             };
         }
@@ -691,7 +692,7 @@ namespace o0.Project
                 var scale = 1.0f / maxWhite;        // 放大对比度
 
                 var differPixel = new UnityEngine.Color[Size.x * Size.y];
-                //var whitePixel = new UnityEngine.Color[Size.x * Size.y];
+                var whitePixel = new UnityEngine.Color[Size.x * Size.y];
                 Parallel.For(0, Size.x, x =>
                 {
                     for (int y = 0; y < Size.y; y++)
@@ -699,11 +700,11 @@ namespace o0.Project
                         var i = y * Size.x + x;
                         var d = ScreenWhiteTexture[i] - ScreenBlackTexture[i];
                         differPixel[i] = new UnityEngine.Color(d.x, d.y, d.z) * scale;
-                        //whitePixel[i] = new UnityEngine.Color(ScreenWhiteTexture[i].x, ScreenWhiteTexture[i].y, ScreenWhiteTexture[i].z) * scale;
+                        whitePixel[i] = new UnityEngine.Color(ScreenWhiteTexture[i].x, ScreenWhiteTexture[i].y, ScreenWhiteTexture[i].z) * scale;
                     }
                 });
                 PixelsMultipleBatches.Add(differPixel);     // 色差图
-                //PixelsMultipleBatches.Add(whitePixel);    // 原图
+                PixelsMultipleBatches.Add(whitePixel);      // 原图
             }
 
             int conSize = (int)Math.Ceiling(0.007f * Size.y) * 2 + 1;
@@ -804,9 +805,9 @@ namespace o0.Project
             foreach (var i in LineIdentifiedSemiAuto.Index())
             {
                 if (LastQuadSemiAutoState[i])
-                    o0Extension.DrawLine(ScreenQuadMap, LineIdentifiedSemiAuto[i].DrawLine, (x, y) => 2, new Geometry2D.Float.Vector(0, 10));
+                    o0Extension.DrawLine(ScreenQuadMap, LineIdentifiedSemiAuto[i].DrawLine, (x, y) => 5, new Geometry2D.Float.Vector(0, 10));
                 else
-                    o0Extension.DrawLine(ScreenQuadMap, LineIdentifiedSemiAuto[i].DrawLine, (x, y) => 1, new Geometry2D.Float.Vector(0, 6), true);
+                    o0Extension.DrawLine(ScreenQuadMap, LineIdentifiedSemiAuto[i].DrawLine, (x, y) => 3, new Geometry2D.Float.Vector(0, 6), true);
             }
 
             // 绘制全自动
@@ -821,7 +822,7 @@ namespace o0.Project
             foreach (var l in allLines)
             {
                 if (l.DrawLine != null)
-                    o0Extension.DrawLine(allLinesMap, l.DrawLine, (x, y) => 3, new Geometry2D.Float.Vector(0, 2), true);
+                    o0Extension.DrawLine(allLinesMap, l.DrawLine, (x, y) => 1, new Geometry2D.Float.Vector(0, 2), true);
             }
             var allLinesTex = allLinesMap.ToTexRGBA(FloatValueToColor);
             ScreenLocate.DebugTexture(1, allLinesTex);
@@ -831,17 +832,17 @@ namespace o0.Project
             foreach (var l in possibleLines)
             {
                 if (l != null && !quadLinesSemiAuto.Contains(l) && !manualLines.Contains(l))
-                    o0Extension.DrawLine(ChoosableLineMap, l.DrawLine, (x, y) => 3, new Geometry2D.Float.Vector(0, 2), true); // 其他的备选线段
+                    o0Extension.DrawLine(ChoosableLineMap, l.DrawLine, (x, y) => 1, new Geometry2D.Float.Vector(0, 2), true); // 其他的备选线段
             }
             foreach (var l in LineIdentifiedSemiAuto)
             {
                 if (l != null)
-                    o0Extension.DrawLine(ChoosableLineMap, l.DrawLine, (x, y) => 2, new Geometry2D.Float.Vector(0, 5)); // 识别的结果
+                    o0Extension.DrawLine(ChoosableLineMap, l.DrawLine, (x, y) => 5, new Geometry2D.Float.Vector(0, 5)); // 识别的结果
             }
             if (manualLines != null)
             {
                 foreach (var l in manualLines)
-                    o0Extension.DrawLine(ChoosableLineMap, l.DrawLine, (x, y) => 1, new Geometry2D.Float.Vector(0, 2), true);     // 旧的屏幕线段(例如上次手动识别的)
+                    o0Extension.DrawLine(ChoosableLineMap, l.DrawLine, (x, y) => 3, new Geometry2D.Float.Vector(0, 2), true);     // 旧的屏幕线段(例如上次手动识别的)
             }
             Texture2D ChoosableLineTex = ChoosableLineMap.ToTexRGBA(FloatValueToColor);
             #endregion