|
|
@@ -135,6 +135,7 @@ public partial class ScreenLocate : o0InfraredCameraHandler
|
|
|
public RectTransform ScreenQuad;
|
|
|
public Toggle SaveToggle;
|
|
|
public Toggle FullScreenToggle;
|
|
|
+ public Toggle SingleToggle;
|
|
|
public LineGenerator UILineGenerator;
|
|
|
|
|
|
public bool ShowScreenQuad = false;
|
|
|
@@ -343,6 +344,38 @@ public partial class ScreenLocate : o0InfraredCameraHandler
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
+ // 初始化算法
|
|
|
+ void AlgorithmInit()
|
|
|
+ {
|
|
|
+ if (screenIdentification == null)
|
|
|
+ {
|
|
|
+ screenIdentification = new o0.Project.ScreenIdentification(this);
|
|
|
+
|
|
|
+ Debug.Log("[ScreenLocate] 初始化屏幕识别");
|
|
|
+ //screenIdentification.OnLocateScreenEnter += OnLocateScreenEnter;
|
|
|
+ screenIdentification.OnLocateScreenEnd += OnLocateScreenEnd;
|
|
|
+ }
|
|
|
+ if (infraredLocate == null)
|
|
|
+ {
|
|
|
+ infraredLocate = new InfraredLocate(this, screenIdentification.Screen);
|
|
|
+ cameraSize = new Vector(getUVCCameraInfoSize.x, getUVCCameraInfoSize.y);
|
|
|
+ InfraredSpot.RefreshMinVerifyLength(new o0.Geometry2D.Float.Vector(getUVCCameraInfoSize.x, getUVCCameraInfoSize.y));
|
|
|
+
|
|
|
+ Debug.Log($"[ScreenLocate] 初始化红外灯识别, 当前相机分辨率: {CameraSize.x}×{CameraSize.y},红外算法追踪距离: {InfraredSpot.MinVerifyLength}");
|
|
|
+ //InfraredDemo 初始化
|
|
|
+ //float redfilterValue = PlayerPrefs.GetFloat("Init redFilterSliderValue", 0.8f);
|
|
|
+ //Debug.Log("Init Red filterValue:" + redfilterValue);
|
|
|
+ //infraredLocate.SetBrightnessThreshold(redfilterValue); // 参数是 红外灯的亮度阈值,阈值越小能够检测到的亮度就越低,默认值是0.93
|
|
|
+
|
|
|
+ // UI相关
|
|
|
+ infraredLocate.SetSinglePoint(SingleToggle.isOn);
|
|
|
+ SingleToggle.onValueChanged.AddListener((i) =>
|
|
|
+ {
|
|
|
+ infraredLocate.SetSinglePoint(i);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
IEnumerator LateDestoryIEnum(UnityEngine.Object o)
|
|
|
{
|
|
|
if (o)
|
|
|
@@ -438,26 +471,7 @@ public partial class ScreenLocate : o0InfraredCameraHandler
|
|
|
|
|
|
if (mUVCCameraInfo == null) return;
|
|
|
|
|
|
- if (screenIdentification == null)
|
|
|
- {
|
|
|
- screenIdentification = new o0.Project.ScreenIdentification(this);
|
|
|
-
|
|
|
- Debug.Log("[ScreenLocate] 初始化屏幕识别");
|
|
|
- //screenIdentification.OnLocateScreenEnter += OnLocateScreenEnter;
|
|
|
- screenIdentification.OnLocateScreenEnd += OnLocateScreenEnd;
|
|
|
- }
|
|
|
- if (infraredLocate == null)
|
|
|
- {
|
|
|
- infraredLocate = new InfraredLocate(this, screenIdentification.Screen);
|
|
|
- cameraSize = new Vector(getUVCCameraInfoSize.x, getUVCCameraInfoSize.y);
|
|
|
- InfraredSpot.RefreshMinVerifyLength(new o0.Geometry2D.Float.Vector(getUVCCameraInfoSize.x, getUVCCameraInfoSize.y));
|
|
|
-
|
|
|
- Debug.Log($"[ScreenLocate] 初始化红外灯识别, 当前相机分辨率: {CameraSize.x}×{CameraSize.y},红外算法追踪距离: {InfraredSpot.MinVerifyLength}");
|
|
|
- //InfraredDemo 初始化
|
|
|
- //float redfilterValue = PlayerPrefs.GetFloat("Init redFilterSliderValue", 0.8f);
|
|
|
- //Debug.Log("Init Red filterValue:" + redfilterValue);
|
|
|
- //infraredLocate.SetBrightnessThreshold(redfilterValue); // 参数是 红外灯的亮度阈值,阈值越小能够检测到的亮度就越低,默认值是0.93
|
|
|
- }
|
|
|
+ AlgorithmInit();
|
|
|
|
|
|
/* New*/
|
|
|
//Debug.Log((mUVCCameraInfo != null) +" = "+ mUVCCameraInfo.IsPreviewing + " = "+ screenIdentification.Screen.Active);
|
|
|
@@ -790,7 +804,7 @@ public partial class ScreenLocate : o0InfraredCameraHandler
|
|
|
if (Vector2.Distance(np, _targetPoints2[index]) >= filterDis)
|
|
|
{
|
|
|
_targetPoints2[index] = np;
|
|
|
- InfraredCameraHelper.InvokeOnPositionUpdate2(_targetPoints2[index], index);
|
|
|
+ InfraredCameraHelper?.InvokeOnPositionUpdate2(_targetPoints2[index], index);
|
|
|
}
|
|
|
}
|
|
|
|