public ProcessorState(
            Ref<System.Drawing.Rectangle> crop, Ref<System.Drawing.Rectangle> crop_values, 
            Ref<int> upper, Ref<int> lower,
            KinectData data_, short[] depth, byte[] depth_label_, byte[] rgb, byte[] bitmap_bits,
            Dictionary<Tuple<byte, byte, byte>, byte> nearest_cache_, Dictionary<byte, byte[]> label_color_,
            byte kBackgroundLabel, List<byte[]> centroid_colors_, List<byte> centroid_labels,
            Ref<bool> predict_on_enable_, Ref<bool>feature_extract_on_enable_,
            Ref<bool> overlay_start_, int kNoOverlay, int[] overlay_bitmap_bits_, int[] kEmptyOverlay,
            FeatureExtractionLib.FeatureExtraction feature, float[] predict_output_, int[] predict_labels_,
            List<IWebSocketConnection> all_sockets_,
            Filter.Step[] pipeline,
            HandGestureFormat hand_gesture_value_, RangeModeFormat range_mode_value_, int[] pool, byte[] bitmap_bits_copy, int radius, double density, int cluster_threshold_count)
        {
            this.crop = crop;
            this.crop_values = crop_values;
            this.upper = upper;
            this.lower = lower;
            this.data_ = data_;
            this.depth = depth;
            this.rgb = rgb;
            this.bitmap_bits_ = bitmap_bits;
            this.depth_label_ = depth_label_;
            this.bitmap_bits_copy_ = bitmap_bits_copy;
            
            this.nearest_cache_ = nearest_cache_;
            this.label_color_ = label_color_;
            this.kBackgroundLabel = kBackgroundLabel;
            this.centroid_colors_ = centroid_colors_;
            this.centroid_labels_ = centroid_labels;

            this.predict_on_enable_ = predict_on_enable_;
            this.feature_extract_on_enable_ = feature_extract_on_enable_;

            this.overlay_start_ = overlay_start_;
            this.kNoOverlay = kNoOverlay;
            this.overlay_bitmap_bits_ = overlay_bitmap_bits_;
            this.kEmptyOverlay = kEmptyOverlay;

            this.feature = feature;
            this.predict_output_ = predict_output_;
            this.predict_labels_ = predict_labels_;

            this.all_sockets_ = all_sockets_;
            this.pipeline = pipeline;

            this.hand_gesture_value_ = hand_gesture_value_;
            this.range_mode_value_ = range_mode_value_;

            this.pool_ = pool;
            this.radius_ = radius;
            this.density_ = density;
            this.cluster_threshold_count_ = cluster_threshold_count;

        }
        private void ReadImageFileToGetDepthAndLabel(string filePath, HandGestureFormat gesture)
        {
            using (System.IO.StreamReader file = new System.IO.StreamReader(filePath))
            {
                string line = file.ReadLine(); // read the whole file into memory
                char[] delimiters = new char[] { '(', ')', ',', ' ' };
                string[] parts = line.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
                //int X = 0, Y = 0;
                int countTargetLabel = 0;
                int countDepthMinusOne = 0;
                int countBackgounrdLabel = 0;
                for (int i = 0; i < width * height; i++)
                {
                    depth[i] = (short)int.Parse(parts[2 * i]);
                    label[i] = (byte)int.Parse(parts[2 * i + 1]);

                    if (depth[i] > (short)1500)
                    {
                        depth[i] = (short)1500;
                        label[i] = 0;
                    }

                    // XXX: This got screwed up! Somehow the label that is saved 
                    // to the image file is *not* the right label. It is always
                    // '4'. So adjusting the label number here.

                    if (depth[i] == -1)
                        countDepthMinusOne++;
                    if (label[i] != 0)
                    {
                        countTargetLabel++;
                        label[i] = (byte)gesture;
                    }
                    else
                        countBackgounrdLabel++;
                }
                //Console.WriteLine("countTargetLabel:{0}, countDepthMinusOne:{1}, countBackgroundLabel:{2}, totalNumber:{3}", countTargetLabel, countDepthMinusOne, countBackgounrdLabel, width * height);
                file.Close();
            };
        }
Ejemplo n.º 3
0
 public Pooled(Point center, int center_depth, HandGestureFormat gesture)
 {
     center_ = center;
     center_depth_ = center_depth;
     gesture_ = gesture;
 }