|
@@ -4,6 +4,7 @@ using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Diagnostics;
|
|
|
+using bbiwarg.Utility;
|
|
|
using bbiwarg.Detectors.Fingers;
|
|
|
using bbiwarg.Detectors.Palm;
|
|
|
using bbiwarg.Detectors.Touch;
|
|
@@ -128,12 +129,17 @@ namespace bbiwarg
|
|
|
|
|
|
private void processFrameUpdate()
|
|
|
{
|
|
|
+ Timer.start("processFrameUpdate");
|
|
|
+
|
|
|
//read data from inputProvider
|
|
|
+ Timer.start("readInputData");
|
|
|
inputFrame = inputProvider.getInputFrame();
|
|
|
Width = inputFrame.Width;
|
|
|
Height = inputFrame.Height;
|
|
|
+ Timer.stop("readInputData");
|
|
|
|
|
|
//create depthImage
|
|
|
+ Timer.start("createDepthImage");
|
|
|
Int16 minDepth = Int16.MaxValue;
|
|
|
Image<Gray, Int16> image = new Image<Gray, Int16>(Width, Height);
|
|
|
for (int x = 0; x < Width; x++)
|
|
@@ -147,25 +153,44 @@ namespace bbiwarg
|
|
|
}
|
|
|
}
|
|
|
depthImage = new DepthImage(image, minDepth);
|
|
|
+ Timer.stop("createDepthImage");
|
|
|
|
|
|
//create images
|
|
|
+ Timer.start("createOtherImages");
|
|
|
edgeImage = new EdgeImage(depthImage);
|
|
|
touchImage = new TouchImage(Width, Height);
|
|
|
fingerImage = new FingerImage(Width, Height);
|
|
|
palmImage = new PalmImage(Width, Height);
|
|
|
+ Timer.stop("createOtherImages");
|
|
|
|
|
|
- //detect+track fingers
|
|
|
+ //detect fingers
|
|
|
+ Timer.start("fingerDetection");
|
|
|
fingerDetector = new FingerDetector(depthImage, edgeImage, fingerImage);
|
|
|
+ Timer.stop("fingerDetection");
|
|
|
+
|
|
|
+ //track fingers
|
|
|
+ Timer.start("fingerTracking");
|
|
|
fingerTracker.setDetectedTouchEventsThisFrame(fingerDetector.Fingers, fingerImage);
|
|
|
+ Timer.stop("fingerTracking");
|
|
|
|
|
|
//detect palm
|
|
|
+ Timer.start("palmDetection");
|
|
|
palmDetector = new PalmDetector(depthImage, edgeImage, fingerDetector.Fingers, palmImage);
|
|
|
+ Timer.stop("palmDetection");
|
|
|
|
|
|
- //detect+track touchEvents
|
|
|
+ //detect touchEvents
|
|
|
+ Timer.start("touchDetection");
|
|
|
touchDetector = new TouchDetector(fingerTracker.TrackedFingers, depthImage, touchImage);
|
|
|
if (palmDetector.PalmQuad != null)
|
|
|
palmTouchDetector = new PalmTouchDetector(touchDetector.TouchEvents, palmDetector.PalmQuad);
|
|
|
+ Timer.stop("touchDetection");
|
|
|
+
|
|
|
+ //track touchEvents
|
|
|
+ Timer.start("touchTracking");
|
|
|
touchTracker.setDetectedTouchEventsThisFrame(touchDetector.TouchEvents, touchImage);
|
|
|
+ Timer.stop("touchTracking");
|
|
|
+
|
|
|
+ Timer.stop("processFrameUpdate");
|
|
|
}
|
|
|
}
|
|
|
}
|