Constants.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 =
  14. LogSubject.FingerTracker;
  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. // confidence image
  23. public static readonly int ConfidenceImageMinThreshold = 500;
  24. // depth image
  25. public static readonly int DepthImageMedianSize = 3;
  26. public static readonly int DepthImageDepthRange = 200; // <255
  27. // edge image
  28. public static readonly int EdgeImageCannyStartThreshold = 100;
  29. public static readonly int EdgeImageCannyLinkingThreshold = 75;
  30. public static readonly int EdgeImageCannySize = 3;
  31. public static readonly int EdgeImageRoughNumDilationIterations = 1;
  32. // finger detection
  33. public static readonly int FingerStepSize = 2;
  34. public static readonly int FingerMaxGapCounter = 5;
  35. public static readonly int FingerMaxSliceDifferencePerStep = 5;
  36. public static readonly int FingerMinNumSlices = 30 / FingerStepSize;
  37. public static readonly int FingerMaxWidth = 30;
  38. public static readonly int FingerMinWidth = 5;
  39. public static readonly int FingerRemoveNumSlicesForCorrection = 5;
  40. public static readonly int FingerNumSlicesForRelativeDirection = FingerRemoveNumSlicesForCorrection;
  41. public static readonly int FingerContourMargin = 2;
  42. public static readonly int FingerSliceOverlapFactor = 2;
  43. public static readonly int FingerCrippleOutFactor = 8;
  44. public static readonly int FingerCrippleOutMinDifference = 15;
  45. // finger tracking
  46. public static readonly int FingerNumFramesUntilTracked = 5;
  47. public static readonly int FingerNumFramesUntilLost = 10;
  48. public static readonly float FingerMinSimilarityForTracking = 0.1f;
  49. public static readonly float FingerSimilarityMaxTipPointDistance = 100;
  50. public static readonly float FingerSimilarityMaxHandPointDistance = 50;
  51. public static readonly float FingerSimilarityMaxAngle = (float)(30 * Math.PI / 180); // 30°
  52. public static readonly float FingerSimilarityMaxParallelDistance = 80;
  53. public static readonly float FingerSimilarityMaxVerticalDistance = 20;
  54. // hand detection
  55. public static readonly float HandMaxSize = 0.7f;
  56. // palm detection
  57. public static readonly float PalmMinDefectMidFingerLineDistance = 20; // defects with mid point ((start + end) / 2) closer than this to a finger line are removed
  58. public static readonly float PalmMaxThumbDefectAngle = 110; // degree
  59. public static readonly float PalmMaxThumbDefectStartEndLengthQuotient = 2.3f;
  60. public static readonly float PalmMinThumbDefectStartEndLengthQuotient = 1.2f;
  61. public static readonly float PalmMinTumbDefectDepthThumbLengthQuotient = 0.8f;
  62. public static readonly float PalmMaxTumbDefectDepthThumbLengthQuotient = 1.2f;
  63. public static readonly float PalmThumbDefectmXX = 50.0f;
  64. public static readonly float PalmThumbDefectmXY = -25.0f;
  65. public static readonly float PalmThumbDefectmYY = 50.0f;
  66. public static readonly float PalmThumbDefectProcessNoise = 5.0e+1f;
  67. public static readonly int PalmNumFramesNoHandReset = 5;
  68. public static readonly float PalmMinAreaQuotient = 0.6f;
  69. public static readonly float PalmMaxAreaQuotient = 1.4f;
  70. //palm Grid
  71. public static readonly int PalmGridRows = 3;
  72. public static readonly int PalmGridColumns = 3;
  73. // touch detection
  74. public static readonly float TouchEventMinTouchValue = 0.4f;
  75. public static readonly int TouchEventAreaSize = 30;
  76. public static readonly int TouchEventFloodfillLowDiff = 1;
  77. public static readonly int TouchEventFloodfillHighDiff = 2;
  78. public static readonly int TouchEventTipInsideFactor = 2;
  79. public static readonly int TouchEventTipOutsideFactor = 7;
  80. public static readonly float TouchmXX = 0.005481396f;
  81. public static readonly float TouchmXY = 0.0003090923f;
  82. public static readonly float TouchmYY = 0.0005702336f;
  83. public static readonly float TouchProcessNoise = 3.0e-4f;
  84. // touch tracking
  85. public static readonly int TouchEventNumFramesUntilTracked = 2;
  86. // colors
  87. public static readonly Color ColorDetected = Color.Turquoise;
  88. public static readonly Color ColorTracked = Color.Yellow;
  89. //public static readonly Color EdgeColor = Color.Blue; // edgeImage draw direct to blue chanel from outputImage
  90. public static readonly Color FingerSliceColor = Color.Magenta;
  91. public static readonly Color FingerDetectedColor = ColorDetected;
  92. public static readonly Color FingerTrackedColor = ColorTracked;
  93. public static readonly Color FingerTipOutSliceColor = Color.Gray;
  94. public static readonly Color FingerHandOutSliceColor = Color.DarkSlateGray;
  95. public static readonly Color FingerContourColor = Color.Red;
  96. public static readonly Color FingerIDColor = Color.White;
  97. public static readonly Color TouchEventDetectedColor = ColorDetected;
  98. public static readonly Color TouchEventTrackedColor = ColorTracked;
  99. public static readonly Color TouchEventTipColor = Color.CornflowerBlue;
  100. public static readonly Color TouchEventAreaMatchedSubtractColor = Color.DarkOrange;
  101. public static readonly Color TouchEventAreaNonMatchedSubtractColor = Color.DarkSlateGray;
  102. public static readonly Color TouchEventStatusBarColor = Color.Green;
  103. public static readonly Color TouchEventVisualizerLineColor = Color.White;
  104. public static readonly Color TouchEventVisualizerPointColor = Color.Red;
  105. public static readonly Color PalmQuadColor = Color.Blue;
  106. public static readonly Color PalmGridColor = Color.CornflowerBlue;
  107. public static readonly Color PalmConturColor = Color.Red;
  108. public static readonly Color PalmConvexHullColor = Color.Green;
  109. public static readonly Color PalmThumbDefectColor = Color.Lime;
  110. }
  111. }