Constants.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using bbiwarg.Utility;
  8. namespace bbiwarg
  9. {
  10. class Constants
  11. {
  12. // Logger
  13. public static readonly LogSubject LogLevel = LogSubject.None;
  14. public static readonly int ConsoleWidth = 90;
  15. public static readonly int ConsoleHeight = 30;
  16. // Output
  17. public static readonly bool OutputEnabled = true;
  18. public static readonly int OutputFrameRate = 30;
  19. public static readonly int OutputNumImages = 5;
  20. public static readonly int OutputNumImagesPerRow = 3;
  21. public static readonly float OutputScaleFactor = 1f; // output window size is scaled by this factor (from necessary size for images)
  22. public static readonly String OutputTitle = "BBIWARG - Output";
  23. // TUIO
  24. public static readonly bool TuioEnabled = true;
  25. public static readonly String TuioIP = "127.0.0.1";
  26. public static readonly int TuioPort = 3333;
  27. // image
  28. public static readonly Vector2D MaxPixel = new Vector2D(319, 239);
  29. public static readonly float ImageDiagonalLength = MaxPixel.Length;
  30. // confidence image
  31. public static readonly int ConfidenceImageMinThreshold = 500;
  32. // depth image
  33. public static readonly int DepthImageMedianSize = 3;
  34. public static readonly int DepthImageDepthRange = 200; // <255
  35. // edge image
  36. public static readonly int EdgeImageCannyStartThreshold = 80;
  37. public static readonly int EdgeImageCannyLinkingThreshold = 60;
  38. public static readonly int EdgeImageCannySize = 3;
  39. public static readonly int EdgeImageRoughNumDilationIterations = 1;
  40. // finger detection
  41. public static readonly int FingerStepSize = 2;
  42. public static readonly int FingerMaxGapCounter = 5;
  43. public static readonly int FingerMaxSliceDifferencePerStep = 5;
  44. public static readonly int FingerMinNumSlices = 25 / FingerStepSize;
  45. public static readonly int FingerNumSlicesForDirectionDetection = FingerMinNumSlices / 4;
  46. public static readonly int FingerMaxWidth = 30;
  47. public static readonly int FingerMinWidth = 5;
  48. public static readonly int FingerRemoveNumSlicesForCorrection = 5;
  49. public static readonly int FingerNumSlicesForRelativeDirection = FingerRemoveNumSlicesForCorrection;
  50. public static readonly int FingerContourMargin = 2;
  51. public static readonly int FingerSliceOverlapFactor = 2;
  52. public static readonly int FingerCrippleOutFactor = 8;
  53. public static readonly int FingerCrippleOutMinDifference = 20;
  54. public static readonly int FingerNumDirectionsForReverseCheck = 20;
  55. // finger tracking
  56. public static readonly int FingerNumFramesDetectedUntilTracked = 5;
  57. public static readonly int FingerNumFramesLostUntilDeleted = 10;
  58. public static readonly float FingerMinSimilarityForTracking = 0.7f;
  59. public static readonly float FingermXX = 0.0005f;
  60. public static readonly float FingermXY = 0.0005f;
  61. public static readonly float FingermYY = 0.0005f;
  62. // hand detection
  63. public static readonly float HandMaxSize = 0.7f;
  64. // palm detection
  65. public static readonly float PalmMinDefectMidFingerLineDistance = 20; // defects with mid point ((start + end) / 2) closer than this to a finger line are removed
  66. public static readonly float PalmMaxThumbDefectAngle = 110; // degree
  67. public static readonly float PalmMaxThumbDefectStartEndLengthQuotient = 2.3f;
  68. public static readonly float PalmMinThumbDefectStartEndLengthQuotient = 1.2f;
  69. public static readonly float PalmMinTumbDefectDepthThumbLengthQuotient = 0.8f;
  70. public static readonly float PalmMaxTumbDefectDepthThumbLengthQuotient = 1.2f;
  71. public static readonly float PalmThumbDefectmXX = 50.0f;
  72. public static readonly float PalmThumbDefectmXY = -25.0f;
  73. public static readonly float PalmThumbDefectmYY = 50.0f;
  74. public static readonly float PalmThumbDefectProcessNoise = 5.0e+1f;
  75. public static readonly int PalmNumFramesNoHandReset = 5;
  76. public static readonly float PalmMinAreaQuotient = 0.4f;
  77. public static readonly float PalmMaxAreaQuotient = 1.8f;
  78. public static readonly float PalmMinPrecentageQuadForeground = 0.8f;
  79. public static readonly float PalmMaxPrecentageQuadForegroundReset = 0.5f;
  80. //palm Grid
  81. public static readonly int PalmGridNumRows = 4;
  82. public static readonly int PalmGridNumColumns = 3;
  83. // touch detection
  84. public static readonly float TouchEventMinTouchValue = 0.3f;
  85. public static readonly int TouchEventAreaSize = 30;
  86. public static readonly int TouchEventFloodfillLowDiff = 1;
  87. public static readonly int TouchEventFloodfillHighDiff = 3;
  88. public static readonly int TouchEventTipInsideFactor = 2;
  89. public static readonly int TouchEventTipOutsideFactor = 7;
  90. public static readonly float TouchProcessNoise = 3.0e-4f;
  91. // touch tracking
  92. public static readonly int TouchEventNumFramesDetectedUntilTracked = 1;
  93. public static readonly int TouchEventNumFramesLostUntilDeleted = 5;
  94. public static readonly float TouchEventMinSimilarityForTracking = 0.7f;
  95. public static readonly float TouchmXX = 0.0065f;
  96. public static readonly float TouchmXY = 0.0f;
  97. public static readonly float TouchmYY = 0.0065f;
  98. // touchEventVisualizer
  99. public static readonly int TouchEventVisualizerFadeOutTime = 1500;
  100. // colors
  101. public static readonly Color ColorDetected = Color.Turquoise;
  102. public static readonly Color ColorTracked = Color.Yellow;
  103. public static readonly Color DepthImageColor = Color.White;
  104. public static readonly Color EdgeImageColor = Color.Blue;
  105. public static readonly Color OutputImageBorderColor = Color.White;
  106. public static readonly Color FingerSliceColor = Color.Magenta;
  107. public static readonly Color FingerDetectedColor = ColorDetected;
  108. public static readonly Color FingerTrackedColor = ColorTracked;
  109. public static readonly Color FingerTipColor = Color.Blue;
  110. public static readonly Color FingerContourColor = Color.Red;
  111. public static readonly Color FingerIDColor = Color.White;
  112. public static readonly Color FingerPointsPredictionColor = Color.Yellow;
  113. public static readonly Color TouchEventDetectedColor = ColorDetected;
  114. public static readonly Color TouchEventTrackedColor = ColorTracked;
  115. public static readonly Color TouchEventAreaMatchedSubtractColor = Color.DarkOrange;
  116. public static readonly Color TouchEventAreaNonMatchedSubtractColor = Color.DarkSlateGray;
  117. public static readonly Color TouchEventStatusBarColor = Color.Green;
  118. public static readonly Color TouchEventVisualizerLineColor = Color.Yellow;
  119. public static readonly Color TouchEventVisualizerPointColor = Color.Red;
  120. public static readonly Color TouchEventVisualizerGridColor = Color.White;
  121. public static readonly Color PalmQuadColor = Color.Blue;
  122. public static readonly Color PalmGridColor = Color.CornflowerBlue;
  123. public static readonly Color PalmConturColor = Color.Red;
  124. public static readonly Color PalmConvexHullColor = Color.Green;
  125. public static readonly Color PalmThumbDefectColor = Color.Lime;
  126. public static readonly Color HandRightColor = Color.Red;
  127. public static readonly Color HandLeftColor = Color.Blue;
  128. }
  129. }