Constants.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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.TouchEvents;
  14. //LogSubject.Timer;
  15. // Output
  16. public static readonly int OutputNumImages = 5;
  17. public static readonly int OutputNumImagesPerRow = 3;
  18. public static readonly float OutputScaleFactor = 1f; // output window size is scaled by this factor (from necessary size for images)
  19. // TUIO
  20. public static readonly String TuioIP = "127.0.0.1";
  21. public static readonly int TuioPort = 3333;
  22. // image
  23. public static readonly int ImageWidth = 320;
  24. public static readonly int ImageHeight = 240;
  25. public static readonly Vector2D ImageMaxPixel = new Vector2D(ImageWidth - 1, ImageHeight - 1);
  26. public static readonly float ImageDiagonalLength = ImageMaxPixel.Length;
  27. // confidence image
  28. public static readonly int ConfidenceImageMinThreshold = 500;
  29. // depth image
  30. public static readonly int DepthImageMedianSize = 3;
  31. public static readonly int DepthImageDepthRange = 200; // <255
  32. // edge image
  33. public static readonly int EdgeImageCannyStartThreshold = 80;
  34. public static readonly int EdgeImageCannyLinkingThreshold = 60;
  35. public static readonly int EdgeImageCannySize = 3;
  36. public static readonly int EdgeImageRoughNumDilationIterations = 1;
  37. // finger detection
  38. public static readonly int FingerStepSize = 2;
  39. public static readonly int FingerMaxGapCounter = 5;
  40. public static readonly int FingerMaxSliceDifferencePerStep = 5;
  41. public static readonly int FingerMinNumSlices = 30 / FingerStepSize;
  42. public static readonly int FingerNumSlicesForDirectionDetection = FingerMinNumSlices / 4;
  43. public static readonly int FingerMaxWidth = 30;
  44. public static readonly int FingerMinWidth = 5;
  45. public static readonly int FingerRemoveNumSlicesForCorrection = 5;
  46. public static readonly int FingerNumSlicesForRelativeDirection = FingerRemoveNumSlicesForCorrection;
  47. public static readonly int FingerContourMargin = 2;
  48. public static readonly int FingerSliceOverlapFactor = 2;
  49. public static readonly int FingerCrippleOutFactor = 8;
  50. public static readonly int FingerCrippleOutMinDifference = 20;
  51. // finger tracking
  52. public static readonly int FingerNumFramesDetectedUntilTracked = 5;
  53. public static readonly int FingerNumFramesLostUntilDeleted = 10;
  54. public static readonly float FingerMinSimilarityForTracking = 0.7f;
  55. //public static readonly float FingerSimilarityMaxAngle = (float)(45 * Math.PI / 180); // 45°
  56. //public static readonly float FingerSimilarityMaxParallelDistance = 100;
  57. //public static readonly float FingerSimilarityMaxVerticalDistance = 20;
  58. // hand detection
  59. public static readonly float HandMaxSize = 0.7f;
  60. // palm detection
  61. public static readonly float PalmMinDefectMidFingerLineDistance = 20; // defects with mid point ((start + end) / 2) closer than this to a finger line are removed
  62. public static readonly float PalmMaxThumbDefectAngle = 110; // degree
  63. public static readonly float PalmMaxThumbDefectStartEndLengthQuotient = 2.3f;
  64. public static readonly float PalmMinThumbDefectStartEndLengthQuotient = 1.2f;
  65. public static readonly float PalmMinTumbDefectDepthThumbLengthQuotient = 0.8f;
  66. public static readonly float PalmMaxTumbDefectDepthThumbLengthQuotient = 1.2f;
  67. public static readonly float PalmThumbDefectmXX = 50.0f;
  68. public static readonly float PalmThumbDefectmXY = -25.0f;
  69. public static readonly float PalmThumbDefectmYY = 50.0f;
  70. public static readonly float PalmThumbDefectProcessNoise = 5.0e+1f;
  71. public static readonly int PalmNumFramesNoHandReset = 5;
  72. public static readonly float PalmMinAreaQuotient = 0.6f;
  73. public static readonly float PalmMaxAreaQuotient = 1.4f;
  74. public static readonly float PalmMinPrecentageQuadForeground = 0.8f;
  75. public static readonly float PalmMaxPrecentageQuadForegroundReset = 0.5f;
  76. //palm Grid
  77. public static readonly int PalmGridRows = 3;
  78. public static readonly int PalmGridColumns = 3;
  79. // touch detection
  80. public static readonly float TouchEventMinTouchValue = 0.3f;
  81. public static readonly int TouchEventAreaSize = 30;
  82. public static readonly int TouchEventFloodfillLowDiff = 1;
  83. public static readonly int TouchEventFloodfillHighDiff = 3;
  84. public static readonly int TouchEventTipInsideFactor = 1;
  85. public static readonly int TouchEventTipOutsideFactor = 7;
  86. public static readonly float TouchmXX = 0.0008f;
  87. public static readonly float TouchmXY = 0.0f;
  88. public static readonly float TouchmYY = 0.0008f;
  89. public static readonly float TouchProcessNoise = 3.0e-4f;
  90. // touch tracking
  91. public static readonly int TouchEventNumFramesDetectedUntilTracked = 1;
  92. public static readonly int TouchEventNumFramesLostUntilDeleted = 1;
  93. public static readonly float TouchEventMinSimilarityForTracking = 0.7f;
  94. // colors
  95. public static readonly Color ColorDetected = Color.Turquoise;
  96. public static readonly Color ColorTracked = Color.Yellow;
  97. //public static readonly Color EdgeColor = Color.Blue; // edgeImage draw direct to blue chanel from outputImage
  98. public static readonly Color FingerSliceColor = Color.Magenta;
  99. public static readonly Color FingerDetectedColor = ColorDetected;
  100. public static readonly Color FingerTrackedColor = ColorTracked;
  101. public static readonly Color FingerTipOutSliceColor = Color.Gray;
  102. public static readonly Color FingerHandOutSliceColor = Color.DarkSlateGray;
  103. public static readonly Color FingerContourColor = Color.Red;
  104. public static readonly Color FingerIDColor = Color.White;
  105. public static readonly Color TouchEventDetectedColor = ColorDetected;
  106. public static readonly Color TouchEventTrackedColor = ColorTracked;
  107. public static readonly Color TouchEventTipColor = Color.CornflowerBlue;
  108. public static readonly Color TouchEventAreaMatchedSubtractColor = Color.DarkOrange;
  109. public static readonly Color TouchEventAreaNonMatchedSubtractColor = Color.DarkSlateGray;
  110. public static readonly Color TouchEventStatusBarColor = Color.Green;
  111. public static readonly Color TouchEventVisualizerLineColor = Color.Yellow;
  112. public static readonly Color TouchEventVisualizerPointColor = Color.Red;
  113. public static readonly Color TouchEventVisualizerGridColor = Color.White;
  114. public static readonly Color PalmQuadColor = Color.Blue;
  115. public static readonly Color PalmGridColor = Color.CornflowerBlue;
  116. public static readonly Color PalmConturColor = Color.Red;
  117. public static readonly Color PalmConvexHullColor = Color.Green;
  118. public static readonly Color PalmThumbDefectColor = Color.Lime;
  119. }
  120. }