Action1010.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using PaintDotNet.Data.Param;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Drawing;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace PaintDotNet.Data.Action
  9. {
  10. /// <summary>
  11. /// 物相间距
  12. /// </summary>
  13. public class Action1010 : ActionAnalysis
  14. {
  15. /// <summary>
  16. /// 无视场执行提取
  17. /// </summary>
  18. /// <param name="src"></param>
  19. /// <returns></returns>
  20. public override OpenCvSharp.Mat PerformProcess(OpenCvSharp.Mat src)
  21. {
  22. return Adjust.BinaryExtractionIntent.ImageBinaryExtraction(src, this.Lists);
  23. }
  24. /// <summary>
  25. /// 多视场执行提取
  26. /// </summary>
  27. /// <param name="src">视场mat</param>
  28. /// <param name="mat">原图mat</param>
  29. /// <returns></returns>
  30. public override OpenCvSharp.Mat PerformProcess(OpenCvSharp.Mat src, OpenCvSharp.Mat mat)
  31. {
  32. return Adjust.BinaryExtractionIntent.ImageBinaryExtraction(src, mat, this.Lists);
  33. }
  34. /// <summary>
  35. /// 用于初始化参数
  36. /// </summary>
  37. public Action1010()
  38. {
  39. this.MenuId = ActionType.ActionBinaryExtraction;
  40. this.OpenImage = "current";
  41. //线宽
  42. IntegerNumber eleven = new IntegerNumber(1, 100);
  43. eleven.key = "parameter11";
  44. eleven.name = "线宽";
  45. eleven.initialValue = 2;
  46. eleven.value = 2;
  47. lists.Add(eleven);
  48. //颜色
  49. ColorNumber twelve = new ColorNumber();
  50. twelve.key = "parameter12";
  51. twelve.name = "颜色";
  52. twelve.Value = Color.Blue.ToArgb();
  53. lists.Add(twelve);
  54. //操作
  55. //测量线/截点 1测量线 2截点
  56. ChoiseArray thirteen = new ChoiseArray("parameter13", "操作",
  57. new BooleanObject[]
  58. {
  59. new BooleanObject("1", "测量线", true, null),
  60. new BooleanObject("2", "截点", true, null)
  61. });
  62. thirteen.initialValue = 1;
  63. thirteen.value = 1;
  64. lists.Add(thirteen);
  65. //形状
  66. ChoiseArray fourteen = new ChoiseArray("parameter14", "形状",
  67. new BooleanObject[]
  68. {
  69. new BooleanObject("1", "圆形", true, null),
  70. new BooleanObject("2", "方形", true, null)
  71. });
  72. fourteen.initialValue = 1;
  73. fourteen.value = 1;
  74. lists.Add(fourteen);
  75. //样式
  76. ChoiseArray fifteen = new ChoiseArray("parameter15", "样式",
  77. new BooleanObject[]
  78. {
  79. new BooleanObject("1", "实心", true, null),
  80. new BooleanObject("2", "空心", true, null)
  81. });
  82. fifteen.initialValue = 1;
  83. fifteen.value = 1;
  84. lists.Add(fifteen);
  85. //大小
  86. IntegerNumber sixteen = new IntegerNumber(1, 100);
  87. sixteen.key = "parameter16";
  88. sixteen.name = "大小";
  89. sixteen.initialValue = 20;
  90. sixteen.value = 20;
  91. lists.Add(sixteen);
  92. //颜色
  93. ColorNumber twentyTwo = new ColorNumber();
  94. twentyTwo.key = "parameter22";
  95. twentyTwo.name = "颜色";
  96. twentyTwo.Value = Color.Yellow.ToArgb();
  97. lists.Add(twentyTwo);
  98. //线宽
  99. IntegerNumber seventeen = new IntegerNumber(1, 100);
  100. seventeen.key = "parameter17";
  101. seventeen.name = "线宽";
  102. seventeen.initialValue = 1;
  103. seventeen.value = 1;
  104. lists.Add(seventeen);
  105. //误差
  106. IntegerNumber eighteen = new IntegerNumber(1, 10000);
  107. eighteen.key = "parameter18";
  108. eighteen.name = "误差";
  109. eighteen.initialValue = 30;
  110. eighteen.value = 30;
  111. lists.Add(eighteen);
  112. BooleanObject nineteen = new BooleanObject();
  113. nineteen.key = "parameter19";
  114. nineteen.name = "显示二值数据";
  115. nineteen.initialValue = false;
  116. nineteen.Value = false;
  117. lists.Add(nineteen);
  118. BooleanObject twenty = new BooleanObject();
  119. twenty.key = "parameter20";
  120. twenty.name = "显示网格";
  121. twenty.initialValue = false;
  122. twenty.Value = false;
  123. lists.Add(twenty);
  124. BooleanObject twentyOne = new BooleanObject();
  125. twentyOne.key = "parameter21";
  126. twentyOne.name = "显示截点";
  127. twentyOne.initialValue = false;
  128. twentyOne.Value = false;
  129. lists.Add(twentyOne);
  130. }
  131. }
  132. }