| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using Serenegiant.UVC;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine;
- using ZIM;
- using ZIM.Unity;
- /// <summary>
- /// JC-补充接口
- /// </summary>
- public partial class ScreenLocate : MonoBehaviour
- {
- public bool IsScreenLoateOK()
- {
- return screenIdentification != null &&
- screenIdentification.Screen != null &&
- screenIdentification.Screen.Active;
- }
- public bool IsScreenLocateManualDoing()
- {
- return mode == Mode.ScreenLocateManual;
- }
- public Texture2D EnterScreenLocateManual()
- {
- CreateUVCTexture2DIfNeeded();
- Texture2D texture = mUVCTexture2D.zimAutoLight(0);
- mode = Mode.ScreenLocateManual;
- return texture;
- }
- /// <summary>
- /// 屏幕定位时候的实际点转换成算法里面的点
- /// 左下、右下、右上、左上 => 左下,右下,左上,右上 (算法)
- /// </summary>
- /// <param name="points"></param>
- public void QuitScreenLocateManual(List<Vector2> points)
- {
- if (points != null && points.Count == 4)
- {
- var size = getUVCCameraInfoSize;
- screenIdentification?.SetScreenQuad(
- new QuadrilateralInCamera(
- new o0.Geometry2D.Float.Vector(points[0].x * size.x, points[0].y * size.y),
- new o0.Geometry2D.Float.Vector(points[1].x * size.x, points[1].y * size.y),
- new o0.Geometry2D.Float.Vector(points[3].x * size.x, points[3].y * size.y),
- new o0.Geometry2D.Float.Vector(points[2].x * size.x, points[2].y * size.y),
- size.o0Vector()
- )
- );
- }
- ToMode(Mode.InfraredLocate);
- }
- /// <summary>
- /// 传入算法对应的点来设置算法屏幕四边形
- /// </summary>
- /// <param name="points"></param>
- public void QuadUnityVectorListToScreenQuad(List<Vector2> points)
- {
- if (points != null && points.Count == 4)
- {
- var size = getUVCCameraInfoSize;
- screenIdentification?.SetScreenQuad(
- new QuadrilateralInCamera(
- new o0.Geometry2D.Float.Vector(points[0].x * size.x, points[0].y * size.y),
- new o0.Geometry2D.Float.Vector(points[1].x * size.x, points[1].y * size.y),
- new o0.Geometry2D.Float.Vector(points[2].x * size.x, points[2].y * size.y),
- new o0.Geometry2D.Float.Vector(points[3].x * size.x, points[3].y * size.y),
- size.o0Vector()
- )
- );
- }
- ToMode(Mode.InfraredLocate);
- }
- public void EnterScreenLocateManualAuto()
- {
- BtnScreenLocate();
- }
- public void SetCapture(int value)
- {
- Capture = value;
- }
- public void SetDelay(int value)
- {
- Delay = value;
- }
- }
|