XiGaoZModel.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using OpenCvSharp;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace SmartCoalApplication.Base.AuxiliaryCalcModel
  8. {
  9. public class XiGaoZModel
  10. {
  11. /// <summary>
  12. /// 编号
  13. /// </summary>
  14. public string guid;
  15. /// <summary>
  16. /// 轮廓点集合
  17. /// </summary>
  18. public OpenCvSharp.Point[] points;
  19. /// <summary>
  20. /// 轮廓宽度
  21. /// </summary>
  22. public int width;
  23. /// <summary>
  24. /// 轮廓高度
  25. /// </summary>
  26. public int height;
  27. /// <summary>
  28. /// 最高点
  29. /// </summary>
  30. public int topY;
  31. /// <summary>
  32. /// 最低点
  33. /// </summary>
  34. public int bottomY;
  35. /// <summary>
  36. /// 左侧点
  37. /// </summary>
  38. public int leftX;
  39. /// <summary>
  40. /// 右侧点
  41. /// </summary>
  42. public int rightX;
  43. /// <summary>
  44. /// 存储抠出来的小图,用于方便传递
  45. /// </summary>
  46. public Mat mat;
  47. public void SetPoints(OpenCvSharp.Point[] points)
  48. {
  49. this.points = points;
  50. this.topY = this.points.Min(a => a.Y);
  51. this.bottomY = this.points.Max(a => a.Y);
  52. this.leftX = this.points.Min(a => a.X);
  53. this.rightX = this.points.Max(a => a.X);
  54. this.width = rightX - leftX;
  55. this.height = bottomY - topY;
  56. this.guid = Guid.NewGuid().ToString();
  57. }
  58. }
  59. }