Exemplo n.º 1
0
        public FeatureSet(FeatureSet other)
        {
            this.KeyPoints = new VectorOfKeyPoint();
            this.KeyPoints.Push(other.KeyPoints.ToArray());

            this.Descriptors = other.Descriptors.Clone();

            this.Allocated = other.Allocated;
        }
Exemplo n.º 2
0
        public FeatureSet(FeatureSet other, ICriteria criteria)
        {
            var copy = new FeatureSet(other);
            this.KeyPoints = copy.KeyPoints;
            this.Descriptors = copy.Descriptors;
            this.Allocated = copy.Allocated;

            if (criteria == null)
                return;

            var keypoints = new List<MKeyPoint>(this.KeyPoints.ToArray());
            var descriptors = new List<Matrix<float>>();

            int i = 0;
            while (i < keypoints.Count)
            {
                if (criteria.Accept(this, i))
                {
                    descriptors.Add(this.Descriptors.GetRow(i));
                    i++;
                }
                else
                {
                    keypoints.RemoveAt(i);
                }
            }

            this.KeyPoints.Clear();
            this.KeyPoints.Push(keypoints.ToArray());

            var newDescriptors = new Matrix<float>(descriptors.Count, this.Descriptors.Cols);
            for (int j = 0; j < descriptors.Count; j++)
            {
                for (int col =0; col<this.Descriptors.Cols; col++)
                {
                    this.Descriptors[j, col] = descriptors[j][0, col];
                }
            }

            this.Descriptors = newDescriptors;
        }
Exemplo n.º 3
0
        public void Evaluate(int SpreadMax)
        {
            if (FInput.IsChanged)
            {
                foreach (var set in sets)
                {
                    if (set != null)
                    {
                        set.Update -= new EventHandler(update);
                    }
                }

                this.sets.Clear();

                foreach (var set in FInput)
                {
                    if (set != null)
                    {
                        set.Update += new EventHandler(update);
                        this.sets.Add(set);
                    }
                }

                FPerform = true;
            }

            if (FCriteria.IsChanged)
            {
                foreach (var criteria in criterias)
                {
                    if (criteria != null)
                    {
                        criteria.Update -= new EventHandler(update);
                    }
                }

                this.criterias.Clear();

                foreach (var criteria in FCriteria)
                {
                    if (criteria != null)
                    {
                        criteria.Update += new EventHandler(update);
                        this.criterias.Add(criteria);
                    }
                }

                FPerform = true;
            }

            if (FPerform)
            {
                FPerform = false;

                FOutput.SliceCount = SpreadMax;

                for (int i = 0; i < SpreadMax; i++)
                {
                    if (FInput[i] == null)
                    {
                        FOutput[i] = null;
                    }
                    else
                    {
                        FOutput[i] = new FeatureSet(FInput[i], FCriteria[i]);
                    }
                }
            }
        }
Exemplo n.º 4
0
 public DetectFeaturesInstance()
 {
     this.FeaturesSet = new FeatureSet();
 }
Exemplo n.º 5
0
        public void Evaluate(int SpreadMax)
        {
            if (FInput.IsChanged)
            {
                foreach(var set in sets)
                {
                    if (set != null)
                    {
                        set.Update -= new EventHandler(update);
                    }
                }

                this.sets.Clear();

                foreach (var set in FInput)
                {
                    if (set != null)
                    {
                        set.Update += new EventHandler(update);
                        this.sets.Add(set);
                    }
                }

                FPerform = true;
            }

            if (FCriteria.IsChanged)
            {
                foreach (var criteria in criterias)
                {
                    if (criteria != null)
                        criteria.Update -= new EventHandler(update);
                }

                this.criterias.Clear();

                foreach (var criteria in FCriteria)
                {
                    if (criteria != null)
                    {
                        criteria.Update += new EventHandler(update);
                        this.criterias.Add(criteria);
                    }
                }

                FPerform = true;
            }

            if (FPerform)
            {
                FPerform = false;

                FOutput.SliceCount = SpreadMax;

                for (int i = 0; i < SpreadMax; i++)
                {
                    if (FInput[i] == null)
                        FOutput[i] = null;
                    else
                        FOutput[i] = new FeatureSet(FInput[i], FCriteria[i]);
                }
            }
        }