VisionToolList.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using CaliperTool;
  7. using CommonMethods;
  8. using FindLineTool;
  9. using HalconTool;
  10. namespace VisionJobFactory
  11. {
  12. [VisionToolAttribute(ToolType.HalconTool)]
  13. public class HalconToolInterface : IToolInfo
  14. {
  15. // 必添加输出项
  16. ToolIO outputImage = new ToolIO("OutputImage", null, DataType.Image);
  17. /// <summary>
  18. /// 获取工具的所有信息
  19. /// </summary>
  20. /// <param name="生成的工具名称"></param>
  21. public HalconToolInterface(string toolName)
  22. {
  23. enable = true;
  24. toolType = ToolType.HalconTool;
  25. this.toolName = toolName;
  26. tool = new HalconTool.HalconTool();
  27. FormTool = null;
  28. FormToolName = "HalconTool.FormHalconTool";
  29. toolInput = new List<ToolIO>();
  30. toolOutput = new List<ToolIO>() { outputImage };
  31. }
  32. /// <summary>
  33. /// 只获取选择工具的描述信息
  34. /// </summary>
  35. public HalconToolInterface()
  36. {
  37. toolDescription = "Halcon采集图像接口,可直接连接网口、USB等相机";
  38. }
  39. }
  40. [VisionToolAttribute(ToolType.FindLine)]
  41. public class FindLineToolInterface : IToolInfo
  42. {
  43. ToolIO inputImage = new ToolIO("InputImage", null, DataType.Image);
  44. ToolIO outputXld = new ToolIO("outputXld", null, DataType.Line);
  45. ToolIO startPointRow = new ToolIO("StartPointRow", null, DataType.IntValue);
  46. ToolIO startPointColumn = new ToolIO("StartPointColumn", null, DataType.IntValue);
  47. ToolIO endPointRow = new ToolIO("EndPointRow", null, DataType.IntValue);
  48. ToolIO endPointColumn = new ToolIO("EndPointColumn", null, DataType.IntValue);
  49. public FindLineToolInterface(string toolName)
  50. {
  51. enable = true;
  52. toolType = ToolType.FindLine;
  53. this.toolName = toolName;
  54. tool = new FindLine();
  55. FormToolName = "FindLineTool.FormFindLine";
  56. FormTool = null;
  57. toolInput = new List<ToolIO>() { inputImage };
  58. toolOutput = new List<ToolIO>() { outputXld, startPointRow, startPointColumn, endPointRow, endPointColumn };
  59. }
  60. /// <summary>
  61. /// 只获取选择工具的描述信息
  62. /// </summary>
  63. public FindLineToolInterface()
  64. {
  65. toolDescription = "找线工具";
  66. }
  67. }
  68. [VisionToolAttribute(ToolType.Caliper)]
  69. public class CaliperInterface : IToolInfo
  70. {
  71. ToolIO inputImage = new ToolIO("InputImage", null, DataType.Image);
  72. ToolIO inputCenterRow = new ToolIO("inputCenterRow", null, DataType.IntValue);
  73. ToolIO inputCenterColumn = new ToolIO("inputCenterColumn", null, DataType.IntValue);
  74. ToolIO inputPhi = new ToolIO("inputPhi", null, DataType.IntValue);
  75. ToolIO outputCenterRow = new ToolIO("outputCenterRow", null, DataType.IntValue);
  76. ToolIO outputCenterColumn = new ToolIO("outputCenterColumn", null, DataType.IntValue);
  77. public CaliperInterface(string toolName)
  78. {
  79. enable = true;
  80. toolType = ToolType.Caliper;
  81. this.toolName = toolName;
  82. tool = new Caliper();
  83. FormToolName = "CaliperTool.FormCaliper";
  84. FormTool = null;
  85. toolInput = new List<ToolIO>() { inputImage, inputCenterRow, inputCenterColumn, inputPhi };
  86. toolOutput = new List<ToolIO>() { outputCenterRow, outputCenterColumn };
  87. }
  88. /// <summary>
  89. /// 只获取选择工具的描述信息
  90. /// </summary>
  91. public CaliperInterface()
  92. {
  93. toolDescription = "卡尺工具";
  94. }
  95. }
  96. [VisionToolAttribute(ToolType.BlobAnalyse)]
  97. public class BlobAnalyseToolInterface : IToolInfo
  98. {
  99. }
  100. }