Parcourir la source

auto format on all files

Alexander Hendrich il y a 10 ans
Parent
commit
7c8318254a

+ 3 - 2
bbiwarg/Detectors/Fingers/Finger.cs

@@ -21,12 +21,13 @@ namespace bbiwarg.Detectors.Fingers
             SliceTrail = sliceTrail;
         }
 
-        public Point[] getPolygon() {
+        public Point[] getPolygon()
+        {
             List<Point> pointsA = new List<Point>();
             List<Point> pointsB = new List<Point>();
             //int numSlices = SliceTrail.NumSlices;
             //for (int i = 0; i < numSlices; i++)
-            foreach(FingerSlice slice in SliceTrail.Slices)
+            foreach (FingerSlice slice in SliceTrail.Slices)
             {
                 pointsA.Add(slice.Start);
                 pointsB.Add(slice.End);

+ 2 - 1
bbiwarg/Detectors/Fingers/FingerDetector.cs

@@ -122,7 +122,8 @@ namespace bbiwarg.Detectors.Fingers
 
             List<Vector2D> directions = new List<Vector2D>();
             int numDirections = Math.Min(trail.NumSlices - 1, numDirectionsForAverage);
-            for (int i = 0; i < numDirections; i++) {
+            for (int i = 0; i < numDirections; i++)
+            {
                 directions.Add(trail.Slices[i + 1].Mid - trail.Slices[i].Mid);
             }
 

+ 2 - 1
bbiwarg/Detectors/Fingers/FingerSlice.cs

@@ -15,7 +15,8 @@ namespace bbiwarg.Detectors.Fingers
         public LineSegment2D LineSegment { get; private set; }
         public float Length { get; private set; }
 
-        public FingerSlice(Vector2D start, Vector2D end) {
+        public FingerSlice(Vector2D start, Vector2D end)
+        {
             Start = start;
             End = end;
             Mid = (start + end) / 2;

+ 9 - 5
bbiwarg/Detectors/Fingers/FingerTracker.cs

@@ -14,7 +14,8 @@ namespace bbiwarg.Detectors.Fingers
         private int framesUntilTracked;
         public List<Finger> TrackedFingers { get; private set; }
 
-        public FingerTracker() {
+        public FingerTracker()
+        {
             framesUntilTracked = 3;
             detectedFingers = new List<Finger>[framesUntilTracked];
             TrackedFingers = new List<Finger>();
@@ -55,7 +56,7 @@ namespace bbiwarg.Detectors.Fingers
                     {
                         tracked = false;
                         break;
-                       
+
                     }
                 }
                 if (tracked)
@@ -66,12 +67,15 @@ namespace bbiwarg.Detectors.Fingers
             }
         }
 
-        private Finger getMostSimilarFingerInFrame(Finger finger, int frame) {
+        private Finger getMostSimilarFingerInFrame(Finger finger, int frame)
+        {
             Finger mostSimilarFinger = null;
             float maxSimilarity = 0;
-            foreach (Finger f in detectedFingers[frame]) {
+            foreach (Finger f in detectedFingers[frame])
+            {
                 float similarity = finger.getSimilarity(f);
-                if (similarity > maxSimilarity) {
+                if (similarity > maxSimilarity)
+                {
                     mostSimilarFinger = f;
                     maxSimilarity = similarity;
                 }

+ 1 - 1
bbiwarg/Detectors/Palm/PalmDetector.cs

@@ -49,7 +49,7 @@ namespace bbiwarg.Detectors.Palm
             this.edgeImage = edgeImage;
             this.palmImage = palmImage;
 
-            handImage = depthImage.Image.Convert<Byte>(delegate(byte s) { return (s == depthImage.MaxDepth-depthImage.MinDepth) ? (byte)0 : (byte)1; });
+            handImage = depthImage.Image.Convert<Byte>(delegate(byte s) { return (s == depthImage.MaxDepth - depthImage.MinDepth) ? (byte)0 : (byte)1; });
 
             fingers = getFingersWithoutThumb(detectedFingers);
             buildPointingHandMask();

+ 6 - 3
bbiwarg/Detectors/Touch/PalmTouchDetector.cs

@@ -13,12 +13,15 @@ namespace bbiwarg.Detectors.Touch
     {
         public List<PalmTouchEvent> PalmTouchEvents { get; private set; }
 
-        public PalmTouchDetector(List<TouchEvent> touchEvents, Quadrangle palmQuad) {
+        public PalmTouchDetector(List<TouchEvent> touchEvents, Quadrangle palmQuad)
+        {
             PalmTouchEvents = new List<PalmTouchEvent>();
 
-            foreach (TouchEvent touchEvent in touchEvents) {
+            foreach (TouchEvent touchEvent in touchEvents)
+            {
                 Vector2D relativePos = palmQuad.getRelativePosition(touchEvent.Position);
-                if (relativePos.X >= 0 && relativePos.X <= 1.0 && relativePos.Y >= 0 && relativePos.Y <= 1.0) {
+                if (relativePos.X >= 0 && relativePos.X <= 1.0 && relativePos.Y >= 0 && relativePos.Y <= 1.0)
+                {
                     PalmTouchEvent pte = new PalmTouchEvent(touchEvent.Position, relativePos, touchEvent.FloodValue, touchEvent.Finger);
                     PalmTouchEvents.Add(pte);
                 }

+ 20 - 13
bbiwarg/Detectors/Touch/TouchDetector.cs

@@ -18,17 +18,19 @@ namespace bbiwarg.Detectors.Touch
         private DepthImage depthImage;
         private TouchImage touchImage;
         private List<Finger> fingers;
-        public List<TouchEvent> TouchEvents {get; private set;}
+        public List<TouchEvent> TouchEvents { get; private set; }
 
-        public TouchDetector(List<Finger> fingers, DepthImage depthImage, TouchImage touchImage) {
+        public TouchDetector(List<Finger> fingers, DepthImage depthImage, TouchImage touchImage)
+        {
             this.depthImage = depthImage;
             this.touchImage = touchImage;
             this.fingers = fingers;
             this.TouchEvents = new List<TouchEvent>();
             float floodValueThreshold = 0.5f;
 
-            foreach (Finger finger in fingers) {
-                 Vector2D tipPoint = finger.Tip;
+            foreach (Finger finger in fingers)
+            {
+                Vector2D tipPoint = finger.Tip;
 
                 float floodValue = getFloodValue(tipPoint);
                 if (floodValue > floodValueThreshold)
@@ -38,7 +40,7 @@ namespace bbiwarg.Detectors.Touch
                     float directionFactor = 10;
                     float x = HelperFunctions.thresholdRange<float>(0, depthImage.Width - 1, tipPoint.X + directionFactor * direction.X);
                     float y = HelperFunctions.thresholdRange<float>(0, depthImage.Height - 1, tipPoint.Y + directionFactor * direction.Y);
-                    Vector2D tep = new Vector2D(x,y);
+                    Vector2D tep = new Vector2D(x, y);
 
                     touchImage.setStateAt(tep, TouchImageState.touchDetected);
                     TouchEvent touchEvent = new TouchEvent(tep, floodValue, finger);
@@ -47,11 +49,12 @@ namespace bbiwarg.Detectors.Touch
             }
         }
 
-        private float getFloodValue(Point touchPoint) {
+        private float getFloodValue(Point touchPoint)
+        {
             int searchSize = 15;
             int maxDepthDifference = 20;
             Int16 fingerDiameter = 5;
-            Int16 depthAtTouch = (Int16) (depthImage.getDepthAt(touchPoint) + fingerDiameter);
+            Int16 depthAtTouch = (Int16)(depthImage.getDepthAt(touchPoint) + fingerDiameter);
 
             int minX = Math.Max(touchPoint.X - searchSize, 0);
             int maxX = Math.Min(touchPoint.X + searchSize, depthImage.Width);
@@ -60,11 +63,14 @@ namespace bbiwarg.Detectors.Touch
 
             int matchedPixels = 0;
             int countedPixels = 0;
-            for (int x = minX; x < maxX; x++) {
-                for (int y = minY; y < maxY; y++) {
-                    Int16 depth = depthImage.getDepthAt(x,y);
+            for (int x = minX; x < maxX; x++)
+            {
+                for (int y = minY; y < maxY; y++)
+                {
+                    Int16 depth = depthImage.getDepthAt(x, y);
                     touchImage.setStateAt(x, y, TouchImageState.touchArea);
-                    if (Math.Abs(depthAtTouch - depth) < maxDepthDifference) {
+                    if (Math.Abs(depthAtTouch - depth) < maxDepthDifference)
+                    {
                         matchedPixels++;
                         touchImage.setStateAt(x, y, TouchImageState.touchAreaMatched);
                     }
@@ -75,11 +81,12 @@ namespace bbiwarg.Detectors.Touch
             float rel = (float)matchedPixels / (float)countedPixels;
 
             //status bar (% of matched pixels) -> green
-            for (int x = minX; x < minX + (maxX-minX)*rel; x++) {
+            for (int x = minX; x < minX + (maxX - minX) * rel; x++)
+            {
                 touchImage.setStateAt(x, maxY - 1, TouchImageState.touchAreaStatusBar);
             }
 
-                return rel;
+            return rel;
         }
     }
 }

+ 4 - 2
bbiwarg/Detectors/Touch/TouchEvent.cs

@@ -14,13 +14,15 @@ namespace bbiwarg.Detectors.Touch
         public float FloodValue { get; private set; }
         public Finger Finger { get; private set; }
 
-        public TouchEvent(Vector2D position, float floodValue, Finger finger) {
+        public TouchEvent(Vector2D position, float floodValue, Finger finger)
+        {
             Position = position;
             FloodValue = floodValue;
             Finger = finger;
         }
 
-        public bool isSimilarTo(TouchEvent compareTouchEvent) {
+        public bool isSimilarTo(TouchEvent compareTouchEvent)
+        {
             float maxDistance = 20;
             float distance = Position.getDistanceTo(compareTouchEvent.Position);
             return (distance < maxDistance);

+ 19 - 10
bbiwarg/Detectors/Touch/TouchTracker.cs

@@ -14,20 +14,24 @@ namespace bbiwarg.Detectors.Touch
         private int framesUntilTracked;
         public List<TouchEvent> TrackedTouchEvents;
 
-        public TouchTracker() {
+        public TouchTracker()
+        {
             framesUntilTracked = 2;
             detectedTouchEvents = new List<TouchEvent>[framesUntilTracked];
 
-            for (int i = 0; i < framesUntilTracked; i++) {
+            for (int i = 0; i < framesUntilTracked; i++)
+            {
                 detectedTouchEvents[i] = new List<TouchEvent>();
             }
         }
 
-        public void setDetectedTouchEventsThisFrame(List<TouchEvent> touchEventsThisFrame, TouchImage touchImage) {
+        public void setDetectedTouchEventsThisFrame(List<TouchEvent> touchEventsThisFrame, TouchImage touchImage)
+        {
             this.touchImage = touchImage;
 
-            for (int i = (framesUntilTracked-1); i > 0; i--) {
-                detectedTouchEvents[i] = detectedTouchEvents[i - 1]; 
+            for (int i = (framesUntilTracked - 1); i > 0; i--)
+            {
+                detectedTouchEvents[i] = detectedTouchEvents[i - 1];
             }
             detectedTouchEvents[0] = touchEventsThisFrame;
 
@@ -35,12 +39,15 @@ namespace bbiwarg.Detectors.Touch
             findTrackedTouches();
         }
 
-        private void findTrackedTouches() {
+        private void findTrackedTouches()
+        {
             TrackedTouchEvents = new List<TouchEvent>();
 
-            foreach (TouchEvent te in detectedTouchEvents[0]) {
+            foreach (TouchEvent te in detectedTouchEvents[0])
+            {
                 bool tracked = true;
-                for (int i = 1; i < framesUntilTracked; i++) {
+                for (int i = 1; i < framesUntilTracked; i++)
+                {
                     if (!hasSimilarTouchEventInFrame(te, i)) tracked = false;
                 }
                 if (tracked)
@@ -52,8 +59,10 @@ namespace bbiwarg.Detectors.Touch
             }
         }
 
-        private bool hasSimilarTouchEventInFrame(TouchEvent touchEvent, int frame) {
-            foreach (TouchEvent te in detectedTouchEvents[frame]) {
+        private bool hasSimilarTouchEventInFrame(TouchEvent touchEvent, int frame)
+        {
+            foreach (TouchEvent te in detectedTouchEvents[frame])
+            {
                 if (touchEvent.isSimilarTo(te))
                     return true;
             }

+ 4 - 2
bbiwarg/Graphics/KalmanDemo.cs

@@ -50,8 +50,10 @@ namespace bbiwarg.Graphics
 
             Int16[] textureData = new Int16[3 * width * height];
             int index = 0;
-            for (int y = 0; y < height; ++y) {
-                for (int x = 0; x < width; ++x) {
+            for (int y = 0; y < height; ++y)
+            {
+                for (int x = 0; x < width; ++x)
+                {
                     textureData[index + 0] = image.Data[y, x, 2];
                     textureData[index + 1] = image.Data[y, x, 1];
                     textureData[index + 2] = image.Data[y, x, 0];

+ 10 - 10
bbiwarg/Graphics/OutputWindow.cs

@@ -259,9 +259,9 @@ namespace bbiwarg.Graphics
             GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, videoHandle.Width, videoHandle.Height, 0, PixelFormat.Rgb, PixelType.Short, edgeTextureData);
             GL.Begin(PrimitiveType.Quads);
             GL.Color3(1.0, 1.0, 1.0);
-            GL.TexCoord2(0.0, 0.0); GL.Vertex3(-size_1_5 - gap,  size_2, -0.5);
-            GL.TexCoord2(1.0, 0.0); GL.Vertex3(-size_2   - gap,  size_2, -0.5);
-            GL.TexCoord2(1.0, 1.0); GL.Vertex3(-size_2   - gap, -size_2, -0.5);
+            GL.TexCoord2(0.0, 0.0); GL.Vertex3(-size_1_5 - gap, size_2, -0.5);
+            GL.TexCoord2(1.0, 0.0); GL.Vertex3(-size_2 - gap, size_2, -0.5);
+            GL.TexCoord2(1.0, 1.0); GL.Vertex3(-size_2 - gap, -size_2, -0.5);
             GL.TexCoord2(0.0, 1.0); GL.Vertex3(-size_1_5 - gap, -size_2, -0.5);
             GL.End();
 
@@ -270,22 +270,22 @@ namespace bbiwarg.Graphics
             GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, videoHandle.Width, videoHandle.Height, 0, PixelFormat.Rgb, PixelType.Short, depthTextureData);
             GL.Begin(PrimitiveType.Quads);
             GL.Color3(1.0, 1.0, 1.0);
-            GL.TexCoord2(0.0, 0.0); GL.Vertex3(-size_2,  size_2, -0.5);
-            GL.TexCoord2(1.0, 0.0); GL.Vertex3( size_2,  size_2, -0.5);
-            GL.TexCoord2(1.0, 1.0); GL.Vertex3( size_2, -size_2, -0.5);
+            GL.TexCoord2(0.0, 0.0); GL.Vertex3(-size_2, size_2, -0.5);
+            GL.TexCoord2(1.0, 0.0); GL.Vertex3(size_2, size_2, -0.5);
+            GL.TexCoord2(1.0, 1.0); GL.Vertex3(size_2, -size_2, -0.5);
             GL.TexCoord2(0.0, 1.0); GL.Vertex3(-size_2, -size_2, -0.5);
             GL.End();
 
             GL.Enable(EnableCap.Texture2D);
             GL.BindTexture(TextureTarget.Texture2D, kalmanDemoTextureID);
-            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, videoHandle.Width, videoHandle.Height, 0, PixelFormat.Rgb, PixelType.Short, 
+            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, videoHandle.Width, videoHandle.Height, 0, PixelFormat.Rgb, PixelType.Short,
                 kalmanDemo.getTextureData(videoHandle.Width, videoHandle.Height));
             GL.Begin(PrimitiveType.Quads);
             GL.Color3(1.0, 1.0, 1.0);
-            GL.TexCoord2(0.0, 0.0); GL.Vertex3(size_2   + gap,  size_2, -0.5);
-            GL.TexCoord2(1.0, 0.0); GL.Vertex3(size_1_5 + gap,  size_2, -0.5);
+            GL.TexCoord2(0.0, 0.0); GL.Vertex3(size_2 + gap, size_2, -0.5);
+            GL.TexCoord2(1.0, 0.0); GL.Vertex3(size_1_5 + gap, size_2, -0.5);
             GL.TexCoord2(1.0, 1.0); GL.Vertex3(size_1_5 + gap, -size_2, -0.5);
-            GL.TexCoord2(0.0, 1.0); GL.Vertex3(size_2   + gap, -size_2, -0.5);
+            GL.TexCoord2(0.0, 1.0); GL.Vertex3(size_2 + gap, -size_2, -0.5);
             GL.End();
 
             SwapBuffers();

+ 2 - 2
bbiwarg/Images/DepthImage.cs

@@ -39,7 +39,7 @@ namespace bbiwarg.Images
 
         public Int16 getDepthAt(int x, int y)
         {
-            return (Int16) (MinDepth + Image.Data[y, x, 0]);
+            return (Int16)(MinDepth + Image.Data[y, x, 0]);
         }
 
         public void setDepthAt(Point point, Int16 depth)
@@ -49,7 +49,7 @@ namespace bbiwarg.Images
 
         public void setDepthAt(int x, int y, Int16 depth)
         {
-            Image.Data[y, x, 0] = (byte) (depth - MinDepth);
+            Image.Data[y, x, 0] = (byte)(depth - MinDepth);
         }
 
         public float getRelativeDepthAt(Point point)

+ 14 - 8
bbiwarg/Images/EdgeImage.cs

@@ -12,31 +12,37 @@ namespace bbiwarg.Images
 {
     class EdgeImage
     {
-        public Image<Gray, Byte> Image {get; private set;}
+        public Image<Gray, Byte> Image { get; private set; }
 
-        public EdgeImage(DepthImage depthImage) {
+        public EdgeImage(DepthImage depthImage)
+        {
             Image = depthImage.Image.Canny(100, 75, 3);
         }
 
-        public EdgeImage(Image<Gray, Byte> edgeImage) {
+        public EdgeImage(Image<Gray, Byte> edgeImage)
+        {
             Image = edgeImage;
         }
 
-        public bool isEdgeAt(Point point) {
+        public bool isEdgeAt(Point point)
+        {
             return isEdgeAt(point.X, point.Y);
         }
 
-        public bool isEdgeAt(int x, int y) {
-            return (Image.Data[y,x,0] > 0);
+        public bool isEdgeAt(int x, int y)
+        {
+            return (Image.Data[y, x, 0] > 0);
         }
 
-        public void removeFingerEdges(Finger finger) {
+        public void removeFingerEdges(Finger finger)
+        {
             Point[] polygon = finger.getPolygon();
 
             Image.FillConvexPoly(polygon, new Gray(0));
         }
 
-        public EdgeImage copy() {
+        public EdgeImage copy()
+        {
             return new EdgeImage(Image.Copy());
         }
     }

+ 10 - 5
bbiwarg/Images/FingerImage.cs

@@ -11,7 +11,8 @@ using bbiwarg.Detectors.Fingers;
 
 namespace bbiwarg.Images
 {
-    public enum FingerImageState {
+    public enum FingerImageState
+    {
         none = 0,
         possibleFingerSlice = 1,
         fingerSlice = 2,
@@ -23,17 +24,21 @@ namespace bbiwarg.Images
     {
         private Image<Gray, byte> image;
 
-        public FingerImage(int width, int height) {
+        public FingerImage(int width, int height)
+        {
             image = new Image<Gray, byte>(width, height);
         }
 
-        public FingerImageState getStateAt(int x, int y) {
+        public FingerImageState getStateAt(int x, int y)
+        {
             return (FingerImageState)image.Data[y, x, 0];
         }
 
-        public void drawFinger(Finger finger, FingerImageState state) {
+        public void drawFinger(Finger finger, FingerImageState state)
+        {
             FingerSliceTrail trail = finger.SliceTrail;
-            for (int i = 0; i < trail.NumSlices; i++) {
+            for (int i = 0; i < trail.NumSlices; i++)
+            {
                 drawLine(trail.Slices[i].LineSegment, FingerImageState.fingerSlice);
             }
             drawLine(finger.LineSegment, state);

+ 0 - 24
bbiwarg/Images/PalmImage.cs

@@ -51,7 +51,6 @@ namespace bbiwarg.Images
 
         public void drawGrid(Vector2D a, Vector2D b, Vector2D c, Vector2D d)
         {
-
             int numRows = 4;
             int numColumns = 3;
 
@@ -69,29 +68,6 @@ namespace bbiwarg.Images
             {
                 drawLine(new Emgu.CV.Structure.LineSegment2DF(a + i * relAD, b + i * relBC), PalmImageState.palmGrid);
             }
-
-            /*
-            int columnCount = 4;
-            int rowCount = 3;
-
-        
-
-            Vector2D bc = c - b;
-            for (int i = 1; i < columnCount; i++)
-            {
-                Vector2D bci = b + (bc * ((float)i/columnCount));
-                Vector2D adi = a + (bc * ((float)i/columnCount));
-                drawLine(new LineSegment2DF(bci, adi), PalmImageState.palmGrid);
-            }
-
-            Vector2D ab = b - a;
-            for (int i = 1; i < rowCount; i++)
-            {
-                Vector2D abi = a + (ab * ((float)i / rowCount));
-                Vector2D dci = d + (ab * ((float)i / rowCount));
-                drawLine(new LineSegment2DF(abi, dci), PalmImageState.palmGrid);
-            }
-            */
         }
     }
 }

+ 3 - 2
bbiwarg/Images/TouchImage.cs

@@ -30,7 +30,8 @@ namespace bbiwarg.Images
             image = new Image<Gray, byte>(width, height);
         }
 
-        public void setStateAt(Point point, TouchImageState state) {
+        public void setStateAt(Point point, TouchImageState state)
+        {
             setStateAt(point.X, point.Y, state);
         }
 
@@ -41,7 +42,7 @@ namespace bbiwarg.Images
             int size = 5;
             if (state == TouchImageState.touchTracked || state == TouchImageState.touchDetected)
             {
-                image.Draw(new CircleF(new System.Drawing.PointF(x, y), size), new Gray((byte) state), 0);
+                image.Draw(new CircleF(new System.Drawing.PointF(x, y), size), new Gray((byte)state), 0);
             }
         }
 

+ 6 - 5
bbiwarg/InputProvider/IisuInputProvider.cs

@@ -38,7 +38,7 @@ namespace bbiwarg.InputProviders
         private IDataHandle<Iisu.Data.IImageData> uvImage;
         private IDataHandle<Iisu.Data.IImageData> colorImage;
 
-        public IisuInputProvider(String moviePath = "") 
+        public IisuInputProvider(String moviePath = "")
         {
             if (moviePath.Length != 0)
             {
@@ -93,7 +93,7 @@ namespace bbiwarg.InputProviders
 
             handSides[0] = device.RegisterDataHandle<int>("CI.HAND1.Side");
             handSides[1] = device.RegisterDataHandle<int>("CI.HAND1.Side");
-            
+
             fingerStatus[0] = device.RegisterDataHandle<int[]>("CI.HAND1.FingerStatus");
             fingerStatus[1] = device.RegisterDataHandle<int[]>("CI.HAND2.FingerStatus");
 
@@ -117,7 +117,7 @@ namespace bbiwarg.InputProviders
 
             fingerTipPositions2D[0] = device.RegisterDataHandle<Iisu.Data.Vector2[]>("CI.HAND1.FingerTipPositions2D");
             fingerTipPositions2D[1] = device.RegisterDataHandle<Iisu.Data.Vector2[]>("CI.HAND2.FingerTipPositions2D");
-            
+
             depthImage = device.RegisterDataHandle<Iisu.Data.IImageData>("SOURCE.CAMERA.DEPTH.Image");
             colorImage = device.RegisterDataHandle<Iisu.Data.IImageData>("SOURCE.CAMERA.COLOR.Image");
             confidenceImage = device.RegisterDataHandle<Iisu.Data.IImageData>("SOURCE.CAMERA.CONFIDENCE.Image");
@@ -287,7 +287,8 @@ namespace bbiwarg.InputProviders
             return results;
         }
 
-        public InputFrame getInputFrame() {
+        public InputFrame getInputFrame()
+        {
             //depthData
             Iisu.Data.IImageInfos imageInfos = depthImage.Value.ImageInfos;
             int width = (int)imageInfos.Width;
@@ -331,7 +332,7 @@ namespace bbiwarg.InputProviders
                 throw new ArgumentOutOfRangeException("handIndex is out of range [0,1]");
         }
 
-        private float[] swapXZYtoXYZ(float[] vector) 
+        private float[] swapXZYtoXYZ(float[] vector)
         {
             float dummy = vector[1];
             vector[1] = vector[2];

+ 11 - 6
bbiwarg/InputProvider/InputFrame.cs

@@ -20,7 +20,8 @@ namespace bbiwarg.InputProviders
         private float[] uvData;
         private byte[] rawColorData;
 
-        public InputFrame(int width, int height, int widthRawColor, int heightRawColor, Int16[] depthData, Int16[] confidenceData, float[] uvData, byte[] rawColorData) {
+        public InputFrame(int width, int height, int widthRawColor, int heightRawColor, Int16[] depthData, Int16[] confidenceData, float[] uvData, byte[] rawColorData)
+        {
             this.Width = width;
             this.Height = height;
             this.widthRawColor = widthRawColor;
@@ -31,11 +32,13 @@ namespace bbiwarg.InputProviders
             this.rawColorData = rawColorData;
         }
 
-        public Int16 getDepthAt(int x, int y) {
+        public Int16 getDepthAt(int x, int y)
+        {
             return depthData[y * Width + x];
         }
 
-        public Int16 getConfidenceAt(int x, int y) {
+        public Int16 getConfidenceAt(int x, int y)
+        {
             return confidenceData[y * Width + x];
         }
 
@@ -49,7 +52,8 @@ namespace bbiwarg.InputProviders
             return uvData[2 * (y * Width + x) + 1];
         }
 
-        public Color getColorAt(int x, int y) {
+        public Color getColorAt(int x, int y)
+        {
             float u = getUAt(x, y);
             float v = getVAt(x, y);
 
@@ -58,10 +62,11 @@ namespace bbiwarg.InputProviders
 
             int xInColorImage = (int)(u * widthRawColor) % widthRawColor;
             int yInColorImage = (int)(v * heightRawColor) % heightRawColor;
-            return getRawColorAt(x,y);
+            return getRawColorAt(x, y);
         }
 
-        public Color getRawColorAt(int x, int y) {
+        public Color getRawColorAt(int x, int y)
+        {
             int offset = 4 * (y * widthRawColor + x);
             byte alpha = rawColorData[offset + 3];
             byte red = rawColorData[offset + 2];

+ 1 - 1
bbiwarg/Utility/Kalman2DPositionFilter.cs

@@ -24,7 +24,7 @@ namespace bbiwarg.Utility
             kalman = new Kalman(4, 2, 0);
 
             // initial state (x, y, v_x, v_y)
-            Matrix<float> initialState = new Matrix<float>(new float[] { initialPosition.X, initialPosition.Y, 0.0f, 0.0f});
+            Matrix<float> initialState = new Matrix<float>(new float[] { initialPosition.X, initialPosition.Y, 0.0f, 0.0f });
             kalman.CorrectedState = initialState;
 
             // transition matrix 

+ 2 - 1
bbiwarg/Utility/Line2D.cs

@@ -18,7 +18,8 @@ namespace bbiwarg.Utility
         public Vector2D PointOnLine { get; private set; }
         public Vector2D Direction { get; private set; }
 
-        public Line2D(Vector2D pointOnLine, Vector2D direction) {
+        public Line2D(Vector2D pointOnLine, Vector2D direction)
+        {
             PointOnLine = pointOnLine;
             Direction = direction.normalize();
         }

+ 1 - 1
bbiwarg/Utility/LineSegment2D.cs

@@ -12,7 +12,7 @@ namespace bbiwarg.Utility
         public Vector2D P1 { get; private set; }
         public Vector2D P2 { get; private set; }
         public Line2D Line { get; private set; }
-        public float Length { get { return P1.getDistanceTo(P2); }}
+        public float Length { get { return P1.getDistanceTo(P2); } }
 
         public LineSegment2D(Vector2D p1, Vector2D p2)
         {

+ 1 - 1
bbiwarg/Utility/Quadrangle.cs

@@ -10,7 +10,7 @@ namespace bbiwarg.Utility
 {
     class Quadrangle
     {
-        public Vector2D[] Vertices { get { return new Vector2D[4] {BottomLeft, TopLeft, TopRight, BottomRight}; } }
+        public Vector2D[] Vertices { get { return new Vector2D[4] { BottomLeft, TopLeft, TopRight, BottomRight }; } }
         public Vector2D BottomLeft { get; private set; }
         public Vector2D TopLeft { get; private set; }
         public Vector2D TopRight { get; private set; }

+ 8 - 4
bbiwarg/Utility/Vector2D.cs

@@ -74,18 +74,21 @@ namespace bbiwarg.Utility
             return new Vector2D(X / length, Y / length);
         }
 
-        public bool isWithin(float minX, float minY, float maxX, float maxY) {
+        public bool isWithin(float minX, float minY, float maxX, float maxY)
+        {
             return (X >= minX && Y >= minY && X <= maxX && Y <= maxY);
         }
 
-        public Vector2D getOrthogonal(bool side) {
+        public Vector2D getOrthogonal(bool side)
+        {
             if (side)
                 return new Vector2D(Y, -X);
             else
                 return new Vector2D(-Y, X);
         }
 
-        public Vector2D getInverse() {
+        public Vector2D getInverse()
+        {
             return new Vector2D(-X, -Y);
         }
 
@@ -134,7 +137,8 @@ namespace bbiwarg.Utility
             return new PointF(vec.X, vec.Y);
         }
 
-        public static implicit operator Point(Vector2D vec) {
+        public static implicit operator Point(Vector2D vec)
+        {
             return new Point(vec.IntX, vec.IntY);
         }
 

+ 23 - 14
bbiwarg/VideoHandle.cs

@@ -35,7 +35,8 @@ namespace bbiwarg
         private FingerTracker fingerTracker;
         private TouchTracker touchTracker;
 
-        public VideoHandle(IInputProvider inputProvider) {
+        public VideoHandle(IInputProvider inputProvider)
+        {
             this.inputProvider = inputProvider;
 
             //initialize trackers
@@ -43,14 +44,16 @@ namespace bbiwarg
             fingerTracker = new FingerTracker();
         }
 
-        public void start() {
+        public void start()
+        {
             inputProvider.init();
             inputProvider.start();
             inputProvider.updateFrame();
             processFrameUpdate();
         }
-       
-        public void stop() {
+
+        public void stop()
+        {
             inputProvider.stop();
         }
 
@@ -88,19 +91,23 @@ namespace bbiwarg
             }
         }
 
-        public Int16 getDepthAt(int x, int y) {
+        public Int16 getDepthAt(int x, int y)
+        {
             return depthImage.getDepthAt(x, y);
         }
 
-        public float getRelativeDepth(int x, int y) {
+        public float getRelativeDepth(int x, int y)
+        {
             return depthImage.getRelativeDepthAt(x, y);
         }
 
-        public bool isEdgeAt(int x, int y) {
+        public bool isEdgeAt(int x, int y)
+        {
             return edgeImage.isEdgeAt(x, y);
         }
 
-        public FingerImageState getFingerImageStateAt(int x, int y) {
+        public FingerImageState getFingerImageStateAt(int x, int y)
+        {
             return fingerImage.getStateAt(x, y);
         }
 
@@ -109,7 +116,8 @@ namespace bbiwarg
             return palmImage.getStateAt(x, y);
         }
 
-        public TouchImageState getTouchImageStateAt(int x, int y) {
+        public TouchImageState getTouchImageStateAt(int x, int y)
+        {
             return touchImage.getStateAt(x, y);
         }
 
@@ -128,11 +136,13 @@ namespace bbiwarg
             //create depthImage
             Int16 minDepth = Int16.MaxValue;
             Image<Gray, Int16> image = new Image<Gray, Int16>(Width, Height);
-            for (int x = 0; x < Width; x++) {
-                for (int y = 0; y < Height; y++) {
+            for (int x = 0; x < Width; x++)
+            {
+                for (int y = 0; y < Height; y++)
+                {
                     Int16 depth = inputFrame.getDepthAt(x, y);
                     image.Data[y, x, 0] = depth;
-                    if(depth < minDepth)
+                    if (depth < minDepth)
                         minDepth = depth;
                 }
             }
@@ -153,10 +163,9 @@ namespace bbiwarg
 
             //detect+track touchEvents
             touchDetector = new TouchDetector(fingerTracker.TrackedFingers, depthImage, touchImage);
-            if(palmDetector.PalmQuad != null)
+            if (palmDetector.PalmQuad != null)
                 palmTouchDetector = new PalmTouchDetector(touchDetector.TouchEvents, palmDetector.PalmQuad);
             touchTracker.setDetectedTouchEventsThisFrame(touchDetector.TouchEvents, touchImage);
         }
     }
 }
-