|
|
@@ -437,13 +437,8 @@ public partial class ScreenLocate : MonoBehaviour
|
|
|
screenIdentification = new o0.Project.ScreenIdentification();
|
|
|
|
|
|
Debug.Log("[ScreenLocate] 初始化屏幕识别");
|
|
|
-
|
|
|
- //pc 不切换分辨率了
|
|
|
-#if UNITY_ANDROID
|
|
|
- //screenIdentification.OnLocateScreenEnter += OnLocateScreenEnter;
|
|
|
+ screenIdentification.OnLocateScreenEnter += OnLocateScreenEnter;
|
|
|
screenIdentification.OnLocateScreenEnd += OnLocateScreenEnd;
|
|
|
-#endif
|
|
|
-
|
|
|
}
|
|
|
if (infraredLocate == null)
|
|
|
{
|
|
|
@@ -451,7 +446,7 @@ public partial class ScreenLocate : MonoBehaviour
|
|
|
CameraSize = new o0.Geometry2D.Vector<int>((int)getUVCCameraInfoSize.x, (int)getUVCCameraInfoSize.y);
|
|
|
InfraredSpot.RefreshMinVerifyLength(new o0.Geometry2D.Float.Vector(getUVCCameraInfoSize.x, getUVCCameraInfoSize.y));
|
|
|
|
|
|
- Debug.Log($"[ScreenLocate] 初始化红外灯识别, 当前相机分辨率: [{CameraSize.x}, {CameraSize.y}],红外算法追踪距离: {InfraredSpot.MinVerifyLength}");
|
|
|
+ Debug.Log($"[ScreenLocate] 初始化红外灯识别, 当前相机分辨率: {CameraSize.x}×{CameraSize.y},红外算法追踪距离: {InfraredSpot.MinVerifyLength}");
|
|
|
//InfraredDemo 初始化
|
|
|
//float redfilterValue = PlayerPrefs.GetFloat("Init redFilterSliderValue", 0.8f);
|
|
|
//Debug.Log("Init Red filterValue:" + redfilterValue);
|
|
|
@@ -516,6 +511,12 @@ public partial class ScreenLocate : MonoBehaviour
|
|
|
Main.ShowScreen(screenIdentification.Screen.QuadInCamera);
|
|
|
}
|
|
|
|
|
|
+ if (CameraSize.x != mUVCTexture2D.width || CameraSize.y != mUVCTexture2D.height)
|
|
|
+ {
|
|
|
+ Debug.Log($"<color=red>[ScreenLocate] 分辨率不匹配,相机分辨率为: {getUVCCameraInfoSize}, mUVCTexture2D纹理尺寸: {mUVCTexture2D.width}×{mUVCTexture2D.height}</color>");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 获取像素,用于后续操作
|
|
|
var pixels = mUVCTexture2D.GetPixels(); // 从左往右、从下往上
|
|
|
|
|
|
@@ -802,7 +803,8 @@ public partial class ScreenLocate : MonoBehaviour
|
|
|
}
|
|
|
//Debug.Log("BtnScreenLocate Capture:" + Capture + " ,Delay: " + Delay);
|
|
|
//screenIdentification.LocateScreen(Capture, Delay);
|
|
|
- OnLocateScreenEnter();
|
|
|
+
|
|
|
+ screenIdentification.LocateScreen(); // 自动识别开始的入口
|
|
|
}
|
|
|
// bool log1 = false, log2 = false;
|
|
|
public void OnLocateScreenEnter()
|
|
|
@@ -818,8 +820,6 @@ public partial class ScreenLocate : MonoBehaviour
|
|
|
Vector2 _HighResolution = mUVCCameraInfo.CurrentCalibrationResolution; //最高的分辨率
|
|
|
Resize((int)_HighResolution.x, (int)_HighResolution.y);
|
|
|
|
|
|
- screenIdentification.LocateScreen();
|
|
|
-
|
|
|
//CreateUVCTexture2DIfNeeded();
|
|
|
// log1 = true;
|
|
|
// log2 = true;
|