Parameters.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 System.Net;
  8. using bbiwarg.Utility;
  9. namespace bbiwarg
  10. {
  11. public enum InputType
  12. {
  13. Camera = 0,
  14. Movie = 1
  15. }
  16. class Parameters
  17. {
  18. // input
  19. public static readonly InputType InputSource = InputType.Camera;
  20. public static readonly String InputMoviePath = "..\\..\\videos\\touch\\4.skv";
  21. // Logger
  22. public static readonly LogSubject LogLevel = LogSubject.None;
  23. public static readonly int ConsoleWidth = 90;
  24. public static readonly int ConsoleHeight = 30;
  25. // Output
  26. public static readonly int OutputUpdateRate = 30;
  27. public static readonly int OutputRenderRate = 30;
  28. public static readonly int OutputNumImages = 5;
  29. public static readonly int OutputNumImagesPerRow = 3;
  30. public static readonly float OutputScaleFactor = 1f; // output window size is scaled by this factor (from necessary size for images)
  31. public static readonly String OutputTitle = "BBIWARG - Output";
  32. // TUIO
  33. public static bool TuioEnabled = false;
  34. public static IPAddress TuioIP = new IPAddress(new byte[4] { 127, 0, 0, 1 });
  35. public static Int16 TuioPort = 3333;
  36. // image
  37. public static readonly int ImageWidth = 320;
  38. public static readonly int ImageHeight = 240;
  39. public static readonly int ImageNumPixels = ImageWidth * ImageHeight;
  40. public static readonly Vector2D ImageMaxPixel = new Vector2D(ImageWidth - 1, ImageHeight - 1);
  41. public static readonly float ImageDiagonalLength = ImageMaxPixel.Length;
  42. public static readonly float ImageAspectRatio = (float)ImageWidth / (float)ImageHeight;
  43. // confidence image
  44. public static readonly int ConfidenceImageMinThreshold = 500;
  45. // depth image
  46. public static readonly int DepthImageMedianSize = 5;
  47. public static readonly int DepthImageDepthRange = 200; // <255
  48. // edge image
  49. public static readonly int EdgeImageCannyStartThreshold = 60;
  50. public static readonly int EdgeImageCannyLinkingThreshold = 40;
  51. public static readonly int EdgeImageCannySize = 3;
  52. public static readonly int EdgeImageRoughNumDilationIterations = 1;
  53. // finger detection
  54. public static readonly int FingerStepSize = 2;
  55. public static readonly int FingerMaxGapCounter = 5;
  56. public static readonly int FingerMaxSliceDifferencePerStep = 5;
  57. public static readonly int FingerMinNumSlices = 25 / FingerStepSize;
  58. public static readonly int FingerMaxWidth = 30;
  59. public static readonly int FingerMinWidth = 2;
  60. public static readonly int FingerRemoveNumSlicesForCorrection = 5;
  61. public static readonly int FingerNumSlicesForRelativeDirection = FingerRemoveNumSlicesForCorrection;
  62. public static readonly int FingerOutMargin = 8;
  63. public static readonly int FingerCrippleMinDifference = 20;
  64. public static readonly int FingerContourMargin = 4;
  65. // finger tracking
  66. public static readonly int FingerTrackerNumFramesDetectedUntilTracked = 5;
  67. public static readonly int FingerTrackerNumFramesLostUntilDeleted = 10;
  68. public static readonly float FingerTrackerMaxTipPointMove = 0.25f*ImageDiagonalLength;
  69. public static readonly float FingerTrackerMaxHandPointMove = 0.25f*ImageDiagonalLength;
  70. public static readonly float FingermXX = 0.00005f;
  71. public static readonly float FingermXY = 0.0f;
  72. public static readonly float FingermYY = 0.00005f;
  73. public static readonly int FingerTrackerNumDirectionsForMeanDirection = 10;
  74. // hand detection
  75. public static readonly int HandNumColors = 3;
  76. public static readonly int HandFloodFillDownDiff = 2;
  77. public static readonly int HandFloodFillUpDiff = 2;
  78. public static readonly float HandMaxSize = 0.6f;
  79. public static readonly float HandMinSize = 0.01f;
  80. public static readonly float HandExtensionMaxSize = 0.5f * HandMaxSize;
  81. public static readonly float HandThumbDefectMaxDistanceToThumb = FingerMaxWidth;
  82. public static readonly float HandThumbDefectMinThumbShortLengthRatio = 0.75f;
  83. public static readonly float HandThumbDefectMaxThumbShortLengthRatio = 1.1f;
  84. public static readonly float HandThumbDefectMinShortLongLengthRatio = 0.3f;
  85. public static readonly float HandThumbDefectMaxShortLongLengthRatio = 0.7f;
  86. public static readonly int HandExtendMaxDifference = 40;
  87. // hand tracker
  88. public static readonly int HandTrackerNumFramesDetectedUntilTracked = 2;
  89. public static readonly int HandTrackerNumFramesLostUntilDeleted = 5;
  90. public static readonly float HandTrackerMaxCentroidMove = 0.25f * ImageDiagonalLength;
  91. public static readonly float HandmXX = 0.0005f;
  92. public static readonly float HandmXY = 0.0f;
  93. public static readonly float HandmYY = 0.0005f;
  94. // palm detection
  95. // palm tracker
  96. public static readonly int PalmTrackerNumFramesDetectedUntilTracked = 2;
  97. public static readonly int PalmTrackerNumFramesLostUntilDeleted = 5;
  98. public static readonly float PalmTrackerMaxWristUpperMove = 0.25f * ImageDiagonalLength;
  99. public static readonly float PalmTrackerMaxWristLowerMove = 0.25f * ImageDiagonalLength;
  100. public static readonly float PalmTrackerMaxFingersUpperMove = 0.25f * ImageDiagonalLength;
  101. public static readonly float PalmTrackerMaxFingersLowerMove = 0.25f * ImageDiagonalLength;
  102. public static readonly float PalmmXX = 0.00005f;
  103. public static readonly float PalmmXY = 0.0f;
  104. public static readonly float PalmmYY = 0.00005f;
  105. //palm Grid
  106. public static int PalmGridNumRows = 3;
  107. public static int PalmGridNumColumns = 4;
  108. // touch detection
  109. public static readonly float TouchMinTouchValue = 0.3f;
  110. public static readonly int TouchAreaSize = 30;
  111. public static readonly int TouchFloodfillDownDiff = 1;
  112. public static readonly int TouchFloodfillUpDiff = 3;
  113. public static readonly int TouchTipInsideFactor = 2;
  114. public static readonly int TouchTipOutsideFactor = 7;
  115. // touch tracking
  116. public static readonly int TouchTrackerNumFramesDetectedUntilTracked = 1;
  117. public static readonly int TouchTrackerNumFramesLostUntilDeleted = 5;
  118. public static readonly float TouchTrackerMaxAbsolutePositionMove = 0.25f * ImageDiagonalLength;
  119. public static readonly float TouchTrackerMaxRelativePositionMove = 0.5f;
  120. public static readonly float TouchmXX = 0.003f;
  121. public static readonly float TouchmXY = 0.0f;
  122. public static readonly float TouchmYY = 0.00165f;
  123. public static readonly float TouchProcessNoise = 3.0e-4f;
  124. // touchEventVisualizer
  125. public static readonly int TouchEventVisualizerFadeOutTime = 1500;
  126. // colors
  127. public static readonly Color ColorDetected = Color.Turquoise;
  128. public static readonly Color ColorTracked = Color.Yellow;
  129. public static readonly Color DepthImageColor = Color.White;
  130. public static readonly Color EdgeImageColor = Color.Blue;
  131. public static readonly Color OutputImageBorderColor = Color.White;
  132. public static readonly Color FingerSliceColor = Color.Magenta;
  133. public static readonly Color FingerDetectedColor = ColorDetected;
  134. public static readonly Color FingerTrackedColor = ColorTracked;
  135. public static readonly Color FingerTipColor = Color.Blue;
  136. public static readonly Color FingerContourColor = Color.Red;
  137. public static readonly Color FingerIDColor = Color.White;
  138. public static readonly Color FingerPointsPredictionColor = Color.Yellow;
  139. public static readonly Color FingerMeanDirectionColor = Color.Red;
  140. public static readonly Color TouchEventDetectedColor = ColorDetected;
  141. public static readonly Color TouchEventTrackedColor = ColorTracked;
  142. public static readonly Color TouchEventAreaMatchedSubtractColor = Color.DarkOrange;
  143. public static readonly Color TouchEventAreaNonMatchedSubtractColor = Color.DarkSlateGray;
  144. public static readonly Color TouchEventStatusBarColor = Color.Green;
  145. public static readonly Color TouchEventVisualizerLineColor = Color.Yellow;
  146. public static readonly Color TouchEventVisualizerPointColor = Color.Red;
  147. public static readonly Color TouchEventVisualizerGridColor = Color.White;
  148. public static readonly Color TouchEventVisualizerTextColor = Color.White;
  149. public static readonly Color PalmQuadColor = Color.Blue;
  150. public static readonly Color PalmGridColor = Color.CornflowerBlue;
  151. public static readonly Color[] HandColor = new Color[3] { Color.Red, Color.Blue, Color.Green };
  152. public static readonly Color HandCentroidColor = Color.Yellow;
  153. public static readonly Color HandIDColor = Color.White;
  154. public static readonly Color HandThumbDefectPointColor = Color.Lime;
  155. public static readonly Color HandThumbDefectLineColor = Color.CornflowerBlue;
  156. }
  157. }