Constants.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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.Timer;
  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 float ImageDiagonalLength = new Vector2D(319,239).Length;
  29. // confidence image
  30. public static readonly int ConfidenceImageMinThreshold = 500;
  31. // depth image
  32. public static readonly int DepthImageMedianSize = 3;
  33. public static readonly int DepthImageDepthRange = 200; // <255
  34. // edge image
  35. public static readonly int EdgeImageCannyStartThreshold = 80;
  36. public static readonly int EdgeImageCannyLinkingThreshold = 60;
  37. public static readonly int EdgeImageCannySize = 3;
  38. public static readonly int EdgeImageRoughNumDilationIterations = 1;
  39. // finger detection
  40. public static readonly int FingerStepSize = 2;
  41. public static readonly int FingerMaxGapCounter = 5;
  42. public static readonly int FingerMaxSliceDifferencePerStep = 5;
  43. public static readonly int FingerMinNumSlices = 25 / FingerStepSize;
  44. public static readonly int FingerNumSlicesForDirectionDetection = FingerMinNumSlices / 4;
  45. public static readonly int FingerMaxWidth = 30;
  46. public static readonly int FingerMinWidth = 5;
  47. public static readonly int FingerRemoveNumSlicesForCorrection = 5;
  48. public static readonly int FingerNumSlicesForRelativeDirection = FingerRemoveNumSlicesForCorrection;
  49. public static readonly int FingerContourMargin = 2;
  50. public static readonly int FingerSliceOverlapFactor = 2;
  51. public static readonly int FingerCrippleOutFactor = 8;
  52. public static readonly int FingerCrippleOutMinDifference = 20;
  53. // finger tracking
  54. public static readonly int FingerNumFramesDetectedUntilTracked = 5;
  55. public static readonly int FingerNumFramesLostUntilDeleted = 10;
  56. public static readonly float FingerMinSimilarityForTracking = 0.7f;
  57. //public static readonly float FingerSimilarityMaxAngle = (float)(45 * Math.PI / 180); // 45°
  58. //public static readonly float FingerSimilarityMaxParallelDistance = 100;
  59. //public static readonly float FingerSimilarityMaxVerticalDistance = 20;
  60. // hand detection
  61. public static readonly float HandMaxSize = 0.7f;
  62. // palm detection
  63. public static readonly float PalmMinDefectMidFingerLineDistance = 20; // defects with mid point ((start + end) / 2) closer than this to a finger line are removed
  64. public static readonly float PalmMaxThumbDefectAngle = 110; // degree
  65. public static readonly float PalmMaxThumbDefectStartEndLengthQuotient = 2.3f;
  66. public static readonly float PalmMinThumbDefectStartEndLengthQuotient = 1.2f;
  67. public static readonly float PalmMinTumbDefectDepthThumbLengthQuotient = 0.8f;
  68. public static readonly float PalmMaxTumbDefectDepthThumbLengthQuotient = 1.2f;
  69. public static readonly float PalmThumbDefectmXX = 50.0f;
  70. public static readonly float PalmThumbDefectmXY = -25.0f;
  71. public static readonly float PalmThumbDefectmYY = 50.0f;
  72. public static readonly float PalmThumbDefectProcessNoise = 5.0e+1f;
  73. public static readonly int PalmNumFramesNoHandReset = 5;
  74. public static readonly float PalmMinAreaQuotient = 0.4f;
  75. public static readonly float PalmMaxAreaQuotient = 1.8f;
  76. public static readonly float PalmMinPrecentageQuadForeground = 0.8f;
  77. public static readonly float PalmMaxPrecentageQuadForegroundReset = 0.5f;
  78. //palm Grid
  79. public static readonly int PalmGridNumRows = 3;
  80. public static readonly int PalmGridNumColumns = 3;
  81. // touch detection
  82. public static readonly float TouchEventMinTouchValue = 0.3f;
  83. public static readonly int TouchEventAreaSize = 30;
  84. public static readonly int TouchEventFloodfillLowDiff = 1;
  85. public static readonly int TouchEventFloodfillHighDiff = 3;
  86. public static readonly int TouchEventTipInsideFactor = 2;
  87. public static readonly int TouchEventTipOutsideFactor = 7;
  88. public static readonly float TouchProcessNoise = 3.0e-4f;
  89. // touch tracking
  90. public static readonly int TouchEventNumFramesDetectedUntilTracked = 1;
  91. public static readonly int TouchEventNumFramesLostUntilDeleted = 5;
  92. public static readonly float TouchEventMinSimilarityForTracking = 0.7f;
  93. public static readonly float TouchmXX = 0.0065f;
  94. public static readonly float TouchmXY = 0.0f;
  95. public static readonly float TouchmYY = 0.0065f;
  96. // touchEventVisualizer
  97. public static readonly int TouchEventVisualizerFadeOutTime = 1500;
  98. // colors
  99. public static readonly Color ColorDetected = Color.Turquoise;
  100. public static readonly Color ColorTracked = Color.Yellow;
  101. public static readonly Color DepthImageColor = Color.White;
  102. public static readonly Color EdgeImageColor = Color.Blue;
  103. public static readonly Color OutputImageBorderColor = Color.White;
  104. public static readonly Color FingerSliceColor = Color.Magenta;
  105. public static readonly Color FingerDetectedColor = ColorDetected;
  106. public static readonly Color FingerTrackedColor = ColorTracked;
  107. public static readonly Color FingerTipColor = Color.Blue;
  108. public static readonly Color FingerContourColor = Color.Red;
  109. public static readonly Color FingerIDColor = Color.White;
  110. public static readonly Color TouchEventDetectedColor = ColorDetected;
  111. public static readonly Color TouchEventTrackedColor = ColorTracked;
  112. public static readonly Color TouchEventAreaMatchedSubtractColor = Color.DarkOrange;
  113. public static readonly Color TouchEventAreaNonMatchedSubtractColor = Color.DarkSlateGray;
  114. public static readonly Color TouchEventStatusBarColor = Color.Green;
  115. public static readonly Color TouchEventVisualizerLineColor = Color.Yellow;
  116. public static readonly Color TouchEventVisualizerPointColor = Color.Red;
  117. public static readonly Color TouchEventVisualizerGridColor = Color.White;
  118. public static readonly Color PalmQuadColor = Color.Blue;
  119. public static readonly Color PalmGridColor = Color.CornflowerBlue;
  120. public static readonly Color PalmConturColor = Color.Red;
  121. public static readonly Color PalmConvexHullColor = Color.Green;
  122. public static readonly Color PalmThumbDefectColor = Color.Lime;
  123. public static readonly Color HandRightColor = Color.Red;
  124. public static readonly Color HandLeftColor = Color.Blue;
  125. }
  126. }