Преглед изворни кода

调整一下屏幕识别时的帧率

ZIM пре 1 година
родитељ
комит
78fd9cfecb

+ 1 - 0
Assets/InfraredProject/WebCamera/Script/ZIM/DebugOnDemo.cs

@@ -20,6 +20,7 @@ public class DebugOnDemo : MonoBehaviour
         {
             Screen.fullScreen = i;
         });
+        Application.targetFrameRate = 60;
     }
 
     void Update()

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

@@ -77,8 +77,8 @@ namespace o0.Project
         public ScreenIdentification()
         {
             Screen = new ScreenMap();
-            //OnLocateScreenEnter += () => Debug.Log("OnLocateScreenEnter");
-            //OnLocateScreenEnd += () => Debug.Log("OnLocateScreenEnd");
+            OnLocateScreenEnter += () => Application.targetFrameRate = 30;      // 固定识别的帧率,确保摄像机拍到正确的画面
+            OnLocateScreenEnd += () => Application.targetFrameRate = 60;
         }
 
         public void SetScreenQuad(QuadrilateralInCamera quad) => Screen.QuadInCamera = quad;
@@ -88,7 +88,7 @@ namespace o0.Project
         public bool bStartLocateScreen { get; set; } = false;//是否进行捕获
 
         // 自动识别开始的入口
-        public void LocateScreen(int Capture = 45, int Delay = 45)  //数值单位是frame
+        public void LocateScreen(int Capture = 30, int Delay = 30)  //数值单位是frame
         {
             if (ScreenLocate.Main.DebugScreenImages.Count != 0 && ScreenLocate.Main.DebugOnZIMDemo)     // 这段仅用于测试图片
             {

+ 0 - 2
Assets/InfraredProject/WebCamera/Script/ZIM/ScreenLocate.cs

@@ -281,8 +281,6 @@ public partial class ScreenLocate : MonoBehaviour
     {
         //mainContext = SynchronizationContext.Current;
 
-        // 设置目标帧率为60
-        Application.targetFrameRate = 60;
         canvas = transform.GetComponent<RectTransform>();
 
         mode = Mode.InfraredLocate;