Sfoglia il codice sorgente

Merge branch 'master' of https://git.tk.informatik.tu-darmstadt.de/etri-smartspaces

Alexander Hendrich 11 anni fa
parent
commit
85a194d4b3
2 ha cambiato i file con 18 aggiunte e 1 eliminazioni
  1. 16 0
      bbiwarg/Images/DepthImage.cs
  2. 2 1
      bbiwarg/VideoHandle/VideoHandle.cs

+ 16 - 0
bbiwarg/Images/DepthImage.cs

@@ -71,6 +71,22 @@ namespace bbiwarg.Images
             }
         }
 
+        public void thresholdBinary(Int16 thresholdDepth)
+        {
+            Int16 maxDepth = getMaxDepth();
+            for (int x = 0; x < width; ++x)
+            {
+                for (int y = 0; y < height; ++y)
+                {
+                    Int16 depth = getDepth(x, y);
+                    if (depth <= thresholdDepth)
+                        setDepth(x, y, 0);
+                    else if (depth != maxDepth)
+                        setDepth(x, y, (short) (maxDepth / 2));
+                }
+            }
+        }
+
         public int[] getSmoothedHistogram()
         {
             Int16 minDepth = getMinDepth();

+ 2 - 1
bbiwarg/VideoHandle/VideoHandle.cs

@@ -81,8 +81,9 @@ namespace bbiwarg.VideoHandles
             colorImage = inputProvider.getColorImage();
 
             handImage.filterMedian(3);
-            int minDepth = handImage.getMinDepth();
+            Int16 minDepth = handImage.getMinDepth();
             handImage.thresholdDepth(minDepth, minDepth + 200);
+            handImage.thresholdBinary((short) (minDepth + 50));
 
             histogram = handImage.getSmoothedHistogram();
             segmentationDepth = handImage.getSegmentationDepth();