Example #1
0
        private RecoResult combineResults(List <SymbolRank> topPolar, RecoResult screenResults, int numToReturn)
        {
            List <SymbolRank> fusionResults = new List <SymbolRank>();

            foreach (SymbolRank sr in topPolar)
            {
                SymbolRank part_haus          = screenResults.getSR(ResultType.PARTIAL_HAUSDORFF, sr.Symbol);
                double     part_haus_distance = screenResults.Normalize(ResultType.PARTIAL_HAUSDORFF, part_haus);

                SymbolRank mod_haus          = screenResults.getSR(ResultType.MOD_HAUSDORFF, sr.Symbol);
                double     mod_haus_distance = screenResults.Normalize(ResultType.MOD_HAUSDORFF, mod_haus);

                SymbolRank tanim          = screenResults.getSR(ResultType.TANIMOTO, sr.Symbol);
                double     tanim_distance = screenResults.Normalize(ResultType.TANIMOTO, tanim);

                SymbolRank yule          = screenResults.getSR(ResultType.YULE, sr.Symbol);
                double     yule_distance = 1 - screenResults.Normalize(ResultType.YULE, yule);

                double distance = part_haus_distance + mod_haus_distance + tanim_distance + yule_distance;

                fusionResults.Add(new SymbolRank(distance, sr.Symbol, sr.BestOrientation));
            }

            // sort
            var sortedResults = from result in fusionResults
                                orderby result.Distance ascending
                                select result;

            RecoResult combinedResults = new RecoResult();

            combinedResults.AddRange(ResultType.FUSION, sortedResults.Take(numToReturn));
            return(combinedResults);
        }
Example #2
0
        public object Clone()
        {
            SymbolRank rank = (SymbolRank)this.MemberwiseClone();

            rank._symbol = (BitmapSymbol)this._symbol.Clone();

            return(rank);
        }
Example #3
0
 private void polarRecognition(List <BitmapSymbol> defns)
 {
     foreach (BitmapSymbol bs in defns)
     {
         SymbolRank polar_result = Polar_Mod_Hausdorff(bs);
         _results.Add(ResultType.POLAR, polar_result);
     }
 }
Example #4
0
        /// <summary>
        /// Normalizes the distance of an existing symbol rank in relation to the values of
        /// a particular type.
        /// </summary>
        /// <param name="type">The type to normalize in relation to.</param>
        /// <param name="SR">The SymbolRank to normalize.</param>
        /// <returns>A copy of the SymbolRank, except the distance has been normalized.</returns>
        public double Normalize(ResultType type, SymbolRank SR)
        {
            double min = Best(type).Distance;
            double max = Worst(type).Distance;

            if (Math.Abs(max - min) < double.Epsilon)
            {
                return(double.PositiveInfinity);
            }
            return((SR.Distance - min) / (max - min));
        }
Example #5
0
        private RecoResult polarRecognition(List <BitmapSymbol> defns)
        {
            RecoResult results = new RecoResult();

            foreach (BitmapSymbol bs in defns)
            {
                SymbolRank polar_result = Polar_Mod_Hausdorff(bs);
                results.Add(ResultType.POLAR, polar_result);
            }
            return(results);
        }
Example #6
0
        private void combineResults()
        {
            List <SymbolRank> topPolar = _results.BestN(ResultType.POLAR, NUM_TOP_POLAR_TO_KEEP);

            foreach (SymbolRank sr in topPolar)
            {
                double     distance  = 0.0;
                SymbolRank part_haus = _results.getSR(ResultType.PARTIAL_HAUSDORFF, sr.Symbol);
                distance += _results.Normalize(ResultType.PARTIAL_HAUSDORFF, part_haus);

                SymbolRank mod_haus = _results.getSR(ResultType.MOD_HAUSDORFF, sr.Symbol);
                distance += _results.Normalize(ResultType.MOD_HAUSDORFF, mod_haus);

                SymbolRank tanim = _results.getSR(ResultType.TANIMOTO, sr.Symbol);
                distance += 1 - _results.Normalize(ResultType.TANIMOTO, tanim);

                SymbolRank yule = _results.getSR(ResultType.YULE, sr.Symbol);
                distance += 1 - _results.Normalize(ResultType.YULE, yule);

                _results.Add(ResultType.FUSION, new SymbolRank(distance, sr.Symbol, sr.BestOrientation));
            }
        }
Example #7
0
 public void Add(ResultType type, SymbolRank result)
 {
     _results[type].Add(result);
     _results[type].Sort(delegate(SymbolRank SR1, SymbolRank SR2) { return(SR1.Distance.CompareTo(SR2.Distance)); });
 }
Example #8
0
 public void Add(ResultType type, SymbolRank result)
 {
     _results[type].Add(result);
 }