فهرست منبع

Merge branch 'master' of https://gitee.com/slambb/smart-bow-infrared

slambb 1 سال پیش
والد
کامیت
4407502d90

+ 19 - 18
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;
@@ -781,22 +782,22 @@ namespace o0.Project
             }
             #endregion
 
-            // 优先应用自动的结果(也可以在外部手动设置)
+            // 优先应用自动的结果(也可以在外部手动设置)
             if (QuadSemiAuto == null && QuadAuto == null && Screen.QuadInCamera != null)     // 如果可能,回退到上一个screen
             {
                 Debug.Log($"<color=yellow>[ScreenIdentification] 本次识别失败,回退到上次的识别结果: {Screen.QuadInCamera}</color>");
                 quadTemp.Add(Screen.QuadInCamera);
             }
-            else if (QuadSemiAuto != null)
-            {
-                Debug.Log($"<color=aqua>[ScreenIdentification] 识别到四边形(半自动): {QuadSemiAuto}</color>");
-                quadTemp.Add(QuadSemiAuto);
-            }
             else if (QuadAuto != null)
             {
                 Debug.Log($"<color=aqua>[ScreenIdentification] 识别到四边形(全自动): {QuadAuto}</color>");
                 quadTemp.Add(QuadAuto);
             }
+            else if (QuadSemiAuto != null)
+            {
+                Debug.Log($"<color=aqua>[ScreenIdentification] 识别到四边形(半自动): {QuadSemiAuto}</color>");
+                quadTemp.Add(QuadSemiAuto);
+            }
 
             #region 绘制 output texture
             // 绘制半自动
@@ -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

+ 1 - 1
Assets/InfraredProject/WebCamera/Script/ZIM/ScreenLocate.cs

@@ -845,7 +845,7 @@ public partial class ScreenLocate : MonoBehaviour
         if (DebugOnZIMDemo)
         {
             var webCam = GetComponent<ZIMWebCamera>();
-            GetComponent<ZIMWebCamera>().AdjustResolution(160, 120);
+            GetComponent<ZIMWebCamera>().AdjustResolution((int)EnterResolution.x, (int)EnterResolution.y);
             mUVCCameraInfo.SetSize(webCam.webCamTexture.width, webCam.webCamTexture.height);
         }
 

+ 10 - 2
Assets/InfraredProject/WebCamera/zimWebCamera.unity

@@ -4311,7 +4311,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1645986108}
-  m_Enabled: 1
+  m_Enabled: 0
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
   m_Name: 
@@ -6257,7 +6257,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 4444241363306702547}
-  m_Enabled: 1
+  m_Enabled: 0
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
   m_Name: 
@@ -6341,6 +6341,14 @@ PrefabInstance:
       propertyPath: m_IsActive
       value: 1
       objectReference: {fileID: 0}
+    - target: {fileID: 7518895720434693105, guid: 742f117969807f147b562a0be2d52864, type: 3}
+      propertyPath: m_LocalScale.x
+      value: 1.5
+      objectReference: {fileID: 0}
+    - target: {fileID: 7518895720434693105, guid: 742f117969807f147b562a0be2d52864, type: 3}
+      propertyPath: m_LocalScale.y
+      value: 1.5
+      objectReference: {fileID: 0}
     - target: {fileID: 7518895720462305554, guid: 742f117969807f147b562a0be2d52864, type: 3}
       propertyPath: m_Name
       value: CameraMask