ScreenLocate.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Serenegiant.UVC;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using UnityEngine;
  6. using ZIM;
  7. using ZIM.Unity;
  8. /// <summary>
  9. /// JC-补充接口
  10. /// </summary>
  11. public partial class ScreenLocate : MonoBehaviour
  12. {
  13. public bool IsScreenLoateOK()
  14. {
  15. return screenIdentification != null &&
  16. screenIdentification.Screen != null &&
  17. screenIdentification.Screen.Active;
  18. }
  19. public bool IsScreenLocateManualDoing()
  20. {
  21. return mode == Mode.ScreenLocateManual;
  22. }
  23. public Texture2D EnterScreenLocateManual()
  24. {
  25. CreateUVCTexture2DIfNeeded();
  26. Texture2D texture = mUVCTexture2D.zimAutoLight(0);
  27. mode = Mode.ScreenLocateManual;
  28. return texture;
  29. }
  30. public void QuitScreenLocateManual(List<Vector2> points)
  31. {
  32. if (points != null && points.Count == 4)
  33. {
  34. var size = getUVCCameraInfoSize;
  35. screenIdentification?.SetScreenQuad(
  36. new QuadrilateralInCamera(
  37. new o0.Geometry2D.Float.Vector(points[0].x * size.x, points[0].y * size.y),
  38. new o0.Geometry2D.Float.Vector(points[1].x * size.x, points[1].y * size.y),
  39. new o0.Geometry2D.Float.Vector(points[3].x * size.x, points[3].y * size.y),
  40. new o0.Geometry2D.Float.Vector(points[2].x * size.x, points[2].y * size.y),
  41. size.o0Vector()
  42. )
  43. );
  44. }
  45. ToMode(Mode.InfraredLocate);
  46. }
  47. public void EnterScreenLocateManualAuto()
  48. {
  49. BtnScreenLocate();
  50. }
  51. public void SetCapture(int value)
  52. {
  53. Capture = value;
  54. }
  55. public void SetDelay(int value)
  56. {
  57. Delay = value;
  58. }
  59. }