|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
using InfraredManager;
|
|
using InfraredManager;
|
|
|
using o0;
|
|
using o0;
|
|
|
|
|
+using SixLabors.ImageSharp.PixelFormats;
|
|
|
using SLAMUVC;
|
|
using SLAMUVC;
|
|
|
using System;
|
|
using System;
|
|
|
using System.Collections;
|
|
using System.Collections;
|
|
@@ -52,7 +53,7 @@ public partial class ScreenLocate : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
get
|
|
get
|
|
|
{
|
|
{
|
|
|
- infraredCount = InfraredCount.Double;
|
|
|
|
|
|
|
+ //infraredCount = InfraredCount.Double;
|
|
|
return infraredSpotBuffer;
|
|
return infraredSpotBuffer;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -61,19 +62,35 @@ public partial class ScreenLocate : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
get
|
|
get
|
|
|
{
|
|
{
|
|
|
- infraredCount = InfraredCount.Single;
|
|
|
|
|
|
|
+ //infraredCount = InfraredCount.Single;
|
|
|
return infraredSpotBuffer[0];
|
|
return infraredSpotBuffer[0];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
public InfraredSpot[] infraredSpotBuffer;
|
|
public InfraredSpot[] infraredSpotBuffer;
|
|
|
public string GetInfraredCount() { return infraredCount.ToString(); }
|
|
public string GetInfraredCount() { return infraredCount.ToString(); }
|
|
|
|
|
|
|
|
|
|
+ // 当前 应用/生效 的屏幕四边形数据(QuadrilateralInCamera类)
|
|
|
|
|
+ public QuadrilateralInCamera CurrentScreenQuad => screenIdentification.Screen.QuadInCamera;
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 定位之后,可能有3种结果(手动、半自动、自动),从中选择一种作为最终识别到的屏幕。
|
|
/// 定位之后,可能有3种结果(手动、半自动、自动),从中选择一种作为最终识别到的屏幕。
|
|
|
/// 如果选择的是null,即没有识别到屏幕,则返回false,否则返回true
|
|
/// 如果选择的是null,即没有识别到屏幕,则返回false,否则返回true
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public bool SelectScreenAfterLocate(ScreenIdentificationTag tag) => ScreenIdentification.SelectScreenAfterLocate(tag);
|
|
public bool SelectScreenAfterLocate(ScreenIdentificationTag tag) => ScreenIdentification.SelectScreenAfterLocate(tag);
|
|
|
|
|
|
|
|
|
|
+ /// 上一次屏幕定位的情况, 还未识别(或识别失败)的时候返回值是null
|
|
|
|
|
+ public QuadrilateralInCamera LastQuadState(ScreenIdentificationTag tag)
|
|
|
|
|
+ {
|
|
|
|
|
+ QuadrilateralInCamera target = tag switch
|
|
|
|
|
+ {
|
|
|
|
|
+ ScreenLocate.ScreenIdentificationTag.Manual => ScreenIdentification.QuadManual,
|
|
|
|
|
+ ScreenLocate.ScreenIdentificationTag.SemiAuto => ScreenIdentification.QuadSemiAuto,
|
|
|
|
|
+ ScreenLocate.ScreenIdentificationTag.Auto => ScreenIdentification.QuadAuto,
|
|
|
|
|
+ _ => null
|
|
|
|
|
+ };
|
|
|
|
|
+ return target;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 上一次半自动识别的情况, 还未识别的时候数组是null
|
|
/// 上一次半自动识别的情况, 还未识别的时候数组是null
|
|
|
/// 通过索引获取布尔值,false代表这条边识别失败(回退应用了手动数据), 0-下、1-右、2-上、3-左
|
|
/// 通过索引获取布尔值,false代表这条边识别失败(回退应用了手动数据), 0-下、1-右、2-上、3-左
|
|
@@ -521,10 +538,7 @@ public partial class ScreenLocate : MonoBehaviour
|
|
|
var pixels = mUVCTexture2D.GetPixels(); // 从左往右、从下往上
|
|
var pixels = mUVCTexture2D.GetPixels(); // 从左往右、从下往上
|
|
|
|
|
|
|
|
AutoLightPixels(pixels, CameraSize.x, CameraSize.y);
|
|
AutoLightPixels(pixels, CameraSize.x, CameraSize.y);
|
|
|
- if (bSinglePoint)
|
|
|
|
|
- infraredSpotBuffer = infraredLocate.UpdateSingle(pixels);
|
|
|
|
|
- else
|
|
|
|
|
- infraredSpotBuffer = infraredLocate.Update(pixels);
|
|
|
|
|
|
|
+ InfraredUpdate(pixels);
|
|
|
|
|
|
|
|
if (mode == Mode.ScreenLocateManual)
|
|
if (mode == Mode.ScreenLocateManual)
|
|
|
{
|
|
{
|
|
@@ -726,6 +740,14 @@ public partial class ScreenLocate : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public void InfraredUpdate(Color[] cameraPixels)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (bSinglePoint)
|
|
|
|
|
+ infraredSpotBuffer = infraredLocate.UpdateSingle(cameraPixels);
|
|
|
|
|
+ else
|
|
|
|
|
+ infraredSpotBuffer = infraredLocate.Update(cameraPixels);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private bool RefreshCameraSize()
|
|
private bool RefreshCameraSize()
|
|
|
{
|
|
{
|
|
|
var sizeNew = new o0.Geometry2D.Vector<int>((int)getUVCCameraInfoSize.x, (int)getUVCCameraInfoSize.y);
|
|
var sizeNew = new o0.Geometry2D.Vector<int>((int)getUVCCameraInfoSize.x, (int)getUVCCameraInfoSize.y);
|