Browse Source

added confidenceThreshold to createVertexArray(), now the method only creates a vertex for each pixel if the pixel has a certain (100) confidence -> better performance for increased confidenceThreshold

Alexander Hendrich 11 years ago
parent
commit
573d2ba9a2

+ 3 - 0
bbiwarg/DataSource/IInputProvider.cs

@@ -15,9 +15,12 @@ namespace bbiwarg.DataSource
         void stop();
         void updateFrame();
         void releaseFrame();
+
         float getFrameRate();
         float getHFOV();
         float getVFOV();
+        int getConfidenceThreshold();
+        void setConfidenceThreshold(int value);
         bool isActive();
 
         DepthImage getDepthImage();

+ 19 - 3
bbiwarg/DataSource/IisuInputProvider.cs

@@ -20,6 +20,7 @@ namespace bbiwarg.DataSource
         private IParameterHandle<float> frameRate;
         private IParameterHandle<float> hfov;
         private IParameterHandle<float> vfov;
+        private int confidenceThreshold;
 
         //data
         private IDataHandle<int>[] handStatus = new IDataHandle<int>[2];
@@ -50,6 +51,7 @@ namespace bbiwarg.DataSource
                 sourceIsMovie = false;
             }
             active = false;
+            confidenceThreshold = 100;
         }
 
         // control-methodes
@@ -66,9 +68,13 @@ namespace bbiwarg.DataSource
 
             // parameters
             if (sourceIsMovie)
+            {
                 device.RegisterParameterHandle<int>("SOURCE.MOVIE.PlayMode").Value = 0; // playMode = once
+            }
             else
-                device.RegisterParameterHandle<int>("SOURCE.DEPTHSENSE.AmplitudeThreshold").Value = 100; // confidence-threshhold
+            {
+                device.RegisterParameterHandle<int>("SOURCE.DEPTHSENSE.AmplitudeThreshold").Value = confidenceThreshold; // confidence-threshhold
+            }
 
             frameRate = device.RegisterParameterHandle<float>("SOURCE.FrameRate");
             hfov = device.RegisterParameterHandle<float>("SOURCE.CAMERA.DEPTH.HFOV");
@@ -142,7 +148,7 @@ namespace bbiwarg.DataSource
             device.ReleaseFrame();
         }
 
-        // getParameter-methodes
+        // Parameter-methodes
 
         public float getFrameRate()
         {
@@ -159,13 +165,23 @@ namespace bbiwarg.DataSource
             return vfov.Value;
         }
 
-        // getData-methodes
+        public int getConfidenceThreshold()
+        {
+            return confidenceThreshold;
+        }
+
+        public void setConfidenceThreshold(int value)
+        {
+            confidenceThreshold = value;
+        }
 
         public bool isActive()
         {
             return active;
         }
 
+
+        // Data-methodes
         public DetectionStatus getHandStatus(uint handIndex)
         {
             checkHandIndex(handIndex);

+ 9 - 5
bbiwarg/DataSource/VideoHandle.cs

@@ -122,17 +122,21 @@ namespace bbiwarg.DataSource
         {
             int width = depthImage.getWidth();
             int height = depthImage.getHeight();
+            int confidenceThreshold = inputProvider.getConfidenceThreshold();
 
             int index = 0;
             for (int x = 0; x < width; x++)
             {
                 for (int y = 0; y < height; y++)
                 {
-                    int depth = depthImage.getDepth(x, y);
-                    Color c = getColor(x, y);
-                    create3DVertexFrom2D(x, y, depth, c, index, vertexBuffer);
-                    
-                    index++;
+                    if (confidenceImage.getConfidence(x, y) > confidenceThreshold)
+                    {
+                        int depth = depthImage.getDepth(x, y);
+                        Color c = getColor(x, y);
+                        create3DVertexFrom2D(x, y, depth, c, index, vertexBuffer);
+
+                        index++;
+                    }
                 }
             }
         }