Constants.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. public enum InputType {
  11. Camera = 0,
  12. Movie = 1
  13. }
  14. class Constants
  15. {
  16. // input
  17. public static readonly InputType InputSource = InputType.Camera;
  18. public static readonly String InputMoviePath = "..\\..\\videos\\touch\\4.skv";
  19. // Logger
  20. public static readonly LogSubject LogLevel = LogSubject.None;
  21. public static readonly int ConsoleWidth = 90;
  22. public static readonly int ConsoleHeight = 30;
  23. // Output
  24. public static readonly bool OutputEnabled = true;
  25. public static readonly int OutputFrameRate = 30;
  26. public static readonly int OutputNumImages = 5;
  27. public static readonly int OutputNumImagesPerRow = 3;
  28. public static readonly float OutputScaleFactor = 1f; // output window size is scaled by this factor (from necessary size for images)
  29. public static readonly String OutputTitle = "BBIWARG - Output";
  30. // TUIO
  31. public static readonly bool TuioEnabled = true;
  32. public static readonly String TuioIP = "127.0.0.1";
  33. public static readonly int TuioPort = 3333;
  34. // image
  35. public static readonly Vector2D MaxPixel = new Vector2D(319, 239);
  36. public static readonly float ImageDiagonalLength = MaxPixel.Length;
  37. // confidence image
  38. public static readonly int ConfidenceImageMinThreshold = 500;
  39. // depth image
  40. public static readonly int DepthImageMedianSize = 5;
  41. public static readonly int DepthImageDepthRange = 200; // <255
  42. // edge image
  43. public static readonly int EdgeImageCannyStartThreshold = 80;
  44. public static readonly int EdgeImageCannyLinkingThreshold = 60;
  45. public static readonly int EdgeImageCannySize = 3;
  46. public static readonly int EdgeImageRoughNumDilationIterations = 1;
  47. // finger detection
  48. public static readonly int FingerStepSize = 2;
  49. public static readonly int FingerMaxGapCounter = 5;
  50. public static readonly int FingerMaxSliceDifferencePerStep = 5;
  51. public static readonly int FingerMinNumSlices = 25 / FingerStepSize;
  52. public static readonly int FingerNumSlicesForDirectionDetection = FingerMinNumSlices / 4;
  53. public static readonly int FingerMaxWidth = 30;
  54. public static readonly int FingerMinWidth = 5;
  55. public static readonly int FingerRemoveNumSlicesForCorrection = 5;
  56. public static readonly int FingerNumSlicesForRelativeDirection = FingerRemoveNumSlicesForCorrection;
  57. public static readonly int FingerCrippleOutFactor = 8;
  58. public static readonly int FingerCrippleOutMinDifference = 20;
  59. public static readonly int FingerNumDirectionsForReverseCheck = 20;
  60. public static readonly int FingerSliceOutMargin = 4;
  61. // finger tracking
  62. public static readonly float FingerMinSimilarityForTracking = 0.8f;
  63. public static readonly int FingerNumFramesDetectedUntilTracked = 5;
  64. public static readonly int FingerNumFramesLostUntilDeleted = 10;
  65. public static readonly float FingermXX = 0.0005f;
  66. public static readonly float FingermXY = 0.0005f;
  67. public static readonly float FingermYY = 0.0005f;
  68. // hand detection
  69. public static readonly float HandMaxSize = 0.7f;
  70. public static readonly int HandNumColors = 3;
  71. public static readonly float HandThumbDefectMaxDistanceToThumb = 2 * FingerMaxWidth;
  72. public static readonly float HandThumbDefectMinThumbShortLengthRatio = 0.75f;
  73. public static readonly float HandThumbDefectMaxThumbShortLengthRatio = 1.1f;
  74. public static readonly float HandThumbDefectMinShortLongLengthRatio = 0.3f;
  75. public static readonly float HandThumbDefectMaxShortLongLengthRatio = 0.7f;
  76. // hand tracker
  77. public static readonly float HandTrackerMinSimilarity = 0.7f;
  78. public static readonly int HandTrackerNumFramesDetectedUntilTracked = 2;
  79. public static readonly int HandTrackerNumFramesLostUntilDeleted = 5;
  80. public static readonly float HandmXX = 0.0005f;
  81. public static readonly float HandmXY = 0.0005f;
  82. public static readonly float HandmYY = 0.0005f;
  83. // palm detection
  84. // palm tracker
  85. public static readonly float PalmTrackerMinSimilarity = 0.5f;
  86. public static readonly int PalmTrackerNumFramesDetectedUntilTracked = 2;
  87. public static readonly int PalmTrackerNumFramesLostUntilDeleted = 5;
  88. public static readonly float PalmmXX = 0.00005f;
  89. public static readonly float PalmmXY = 0.00005f;
  90. public static readonly float PalmmYY = 0.00005f;
  91. //palm Grid
  92. public static int PalmGridNumRows = 3;
  93. public static int PalmGridNumColumns = 4;
  94. // touch detection
  95. public static readonly float TouchEventMinTouchValue = 0.3f;
  96. public static readonly int TouchEventAreaSize = 30;
  97. public static readonly int TouchEventFloodfillLowDiff = 1;
  98. public static readonly int TouchEventFloodfillHighDiff = 3;
  99. public static readonly int TouchEventTipInsideFactor = 2;
  100. public static readonly int TouchEventTipOutsideFactor = 7;
  101. public static readonly float TouchProcessNoise = 3.0e-4f;
  102. // touch tracking
  103. public static readonly float TouchEventMinSimilarityForTracking = 0.7f;
  104. public static readonly int TouchEventNumFramesDetectedUntilTracked = 1;
  105. public static readonly int TouchEventNumFramesLostUntilDeleted = 5;
  106. public static readonly float TouchmXX = 0.0065f;
  107. public static readonly float TouchmXY = 0.0f;
  108. public static readonly float TouchmYY = 0.0065f;
  109. // touchEventVisualizer
  110. public static readonly int TouchEventVisualizerFadeOutTime = 1500;
  111. // colors
  112. public static readonly Color ColorDetected = Color.Turquoise;
  113. public static readonly Color ColorTracked = Color.Yellow;
  114. public static readonly Color DepthImageColor = Color.White;
  115. public static readonly Color EdgeImageColor = Color.Blue;
  116. public static readonly Color OutputImageBorderColor = Color.White;
  117. public static readonly Color FingerSliceColor = Color.Magenta;
  118. public static readonly Color FingerDetectedColor = ColorDetected;
  119. public static readonly Color FingerTrackedColor = ColorTracked;
  120. public static readonly Color FingerTipColor = Color.Blue;
  121. public static readonly Color FingerContourColor = Color.Red;
  122. public static readonly Color FingerIDColor = Color.White;
  123. public static readonly Color FingerPointsPredictionColor = Color.Yellow;
  124. public static readonly Color TouchEventDetectedColor = ColorDetected;
  125. public static readonly Color TouchEventTrackedColor = ColorTracked;
  126. public static readonly Color TouchEventAreaMatchedSubtractColor = Color.DarkOrange;
  127. public static readonly Color TouchEventAreaNonMatchedSubtractColor = Color.DarkSlateGray;
  128. public static readonly Color TouchEventStatusBarColor = Color.Green;
  129. public static readonly Color TouchEventVisualizerLineColor = Color.Yellow;
  130. public static readonly Color TouchEventVisualizerPointColor = Color.Red;
  131. public static readonly Color TouchEventVisualizerGridColor = Color.White;
  132. public static readonly Color TouchEventVisualizerTextColor = Color.White;
  133. public static readonly Color PalmQuadColor = Color.Blue;
  134. public static readonly Color PalmGridColor = Color.CornflowerBlue;
  135. public static readonly Color PalmConturColor = Color.Red;
  136. public static readonly Color PalmConvexHullColor = Color.Green;
  137. public static readonly Color PalmThumbDefectColor = Color.Lime;
  138. public static readonly Color[] HandColor = new Color[3] { Color.Red, Color.Blue, Color.Green};
  139. public static readonly Color HandCentroidColor = Color.Yellow;
  140. public static readonly Color HandIDColor = Color.White;
  141. }
  142. }