public List <SymbolRank> Recognize(List <BitmapSymbol> defns) { if (defns.Count == 0) { throw new Exception("The recognizer does not have any templates!"); } if (defns.Count < NUM_TOP_POLAR_TO_KEEP) { NUM_TOP_POLAR_TO_KEEP = defns.Count; } polarRecognition(defns); #if JESSI Console.WriteLine("\nThese templates made it through the polar recognition round:"); foreach (SymbolRank sr in _results.BestN(ResultType.POLAR, NUM_TOP_POLAR_TO_KEEP)) { Console.WriteLine(sr.SymbolName); } #endif screenRecognition(); combineResults(); #if JESSI Console.WriteLine("Your templates have now been reordered by screen recognition:"); foreach (SymbolRank sr in _results.BestN(ResultType.FUSION, NUM_TOP_POLAR_TO_KEEP)) { Console.WriteLine(sr.SymbolName); } #endif return(_results.BestN(ResultType.FUSION, NUM_RECOGNITIONS_TO_RETURN)); }
public RecoResult Recognize(List <BitmapSymbol> defns) { if (defns.Count == 0) { throw new ArgumentException("You must provide a nonempty list of templates!"); } int numTopPolarToKeep = Math.Min(NUM_TOP_POLAR_TO_KEEP, defns.Count); int numRecognitionsToReturn = Math.Min(NUM_RECOGNITIONS_TO_RETURN, defns.Count); RecoResult polarResults = polarRecognition(defns); #if JESSI Console.WriteLine("\nThese templates made it through the polar recognition round:"); foreach (SymbolRank sr in polarResults.BestN(ResultType.POLAR, NUM_TOP_POLAR_TO_KEEP)) { Console.WriteLine(sr.SymbolName); } #endif List <SymbolRank> topPolar = polarResults.BestN(ResultType.POLAR, numTopPolarToKeep); RecoResult screenResults = screenRecognition(topPolar); RecoResult combinedResults = combineResults(topPolar, screenResults, numRecognitionsToReturn); #if JESSI Console.WriteLine("Your templates have now been reordered by screen recognition:"); foreach (SymbolRank sr in combinedResults.BestN(ResultType.FUSION, NUM_TOP_POLAR_TO_KEEP)) { Console.WriteLine(sr.SymbolName); } #endif combinedResults.AddAll(polarResults); combinedResults.AddAll(screenResults); return(combinedResults); }