FindCircle.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using System;
  2. using HalconDotNet;
  3. using static DataStruct.DataStructClass;
  4. using ToolBase;
  5. using CommonMethods;
  6. using ViewROI;
  7. namespace FindCircle
  8. {
  9. [Serializable]
  10. public class FindClrcle: IToolBase
  11. {
  12. /// <summary>
  13. /// 输入位姿
  14. /// </summary>
  15. internal PosXYU inputPose = new PosXYU();
  16. /// <summary>
  17. /// 期望圆圆心行坐标
  18. /// </summary>
  19. internal HTuple expectCircleRow = 300;
  20. /// <summary>
  21. /// 期望圆圆心列坐标
  22. /// </summary>
  23. internal HTuple expectCircleCol = 300;
  24. /// <summary>
  25. /// 期望圆半径
  26. /// </summary>
  27. internal HTuple expectCircleRadius = 200;
  28. /// <summary>
  29. /// 查找到圆的圆心行坐标
  30. /// </summary>
  31. private double _resultCircleRow = 0;
  32. internal double ResultCircleRow
  33. {
  34. get
  35. {
  36. return Math.Round(_resultCircleRow, 3);
  37. }
  38. set { _resultCircleRow = value; }
  39. }
  40. /// <summary>
  41. /// 查找到的圆的圆心列坐标
  42. /// </summary>
  43. private double _resultCircleCol = 0;
  44. internal double ResultCircleCol
  45. {
  46. get
  47. {
  48. return Math.Round(_resultCircleCol, 3);
  49. }
  50. set { _resultCircleCol = value; }
  51. }
  52. /// <summary>
  53. /// 查找到的圆的半径
  54. /// </summary>
  55. private double resultCircleRadius = 0;
  56. internal double ResultCircleRadius
  57. {
  58. get
  59. {
  60. return Math.Round(resultCircleRadius, 3);
  61. }
  62. }
  63. /// <summary>
  64. /// 起始角度
  65. /// </summary>
  66. internal double startAngle = 10;
  67. /// <summary>
  68. /// 结束角度
  69. /// </summary>
  70. internal double endAngle = 360;
  71. /// <summary>
  72. /// 运行工具时是否刷新输入图像
  73. /// </summary>
  74. internal bool updateImage = false;
  75. /// <summary>
  76. /// 圆环径向长度
  77. /// </summary>
  78. internal double ringRadiusLength = 80;
  79. /// <summary>
  80. /// 边阈值
  81. /// </summary>
  82. internal int threshold = 30;
  83. /// <summary>
  84. /// 卡尺
  85. /// </summary>
  86. internal HObject contours;
  87. /// <summary>
  88. /// 找边极性,从明到暗或从暗到明
  89. /// </summary>
  90. internal string polarity = "negative";
  91. /// <summary>
  92. /// 卡尺数量
  93. /// </summary>
  94. internal int cliperNum = 20;
  95. /// <summary>
  96. /// 新的跟随姿态变化后的预期圆信息
  97. /// </summary>
  98. HTuple newExpecCircleRow = new HTuple(200), newExpectCircleCol = new HTuple(200), newExpectCircleRadius = new HTuple(200);
  99. /// <summary>
  100. /// 制作模板时的输入位姿
  101. /// </summary>
  102. internal PosXYU templatePose = new PosXYU();
  103. public override void Run(SoftwareRunState softwareRunState)
  104. {
  105. }
  106. public override void DispImage()
  107. {
  108. }
  109. public override void DispMainWindow(HWindowTool_Smart window)
  110. {
  111. throw new NotImplementedException();
  112. }
  113. }
  114. }