private void screenRecognition() { #if FALSE // useful for debugging rotation List <double> rotateBy = new List <double> { Math.PI / 4, Math.PI / 2, Math.PI }; foreach (double theta in rotateBy) { BitmapSymbol debug = (BitmapSymbol)Clone(); debug.Rotate(theta); } #endif List <SymbolRank> topPolar = _results.BestN(ResultType.POLAR, NUM_TOP_POLAR_TO_KEEP); foreach (SymbolRank sr in topPolar) { #if JESSI Console.WriteLine("Doing screen recognition for template " + sr.SymbolName); #endif // clone the BitmapSymbol so that we can rotate it without losing information BitmapSymbol clone = (BitmapSymbol)Clone(); clone.Rotate(-sr.BestOrientation); // calculate the data using the rotated clone, but store the output in this symbol's results. _results.Add(ResultType.PARTIAL_HAUSDORFF, clone.Partial_Hausdorff(sr.Symbol)); _results.Add(ResultType.MOD_HAUSDORFF, clone.Modified_Hausdorff(sr.Symbol)); _results.Add(ResultType.TANIMOTO, clone.Tanimoto_Distance(sr.Symbol)); _results.Add(ResultType.YULE, clone.Yule_Distance(sr.Symbol)); } }
private RecoResult screenRecognition(List <SymbolRank> topPolar) { RecoResult screenResults = new RecoResult(); foreach (SymbolRank sr in topPolar) { #if JESSI Console.WriteLine(); Console.WriteLine("Doing screen recognition for template " + sr.SymbolName); #endif // clone the BitmapSymbol so that we can rotate it without losing information BitmapSymbol clone = (BitmapSymbol)Clone(); clone.Rotate(-sr.BestOrientation); // calculate the data using the rotated clone, but store the output in this symbol's results. screenResults.Add(ResultType.PARTIAL_HAUSDORFF, clone.Partial_Hausdorff(sr.Symbol)); screenResults.Add(ResultType.MOD_HAUSDORFF, clone.Modified_Hausdorff(sr.Symbol)); screenResults.Add(ResultType.TANIMOTO, clone.Tanimoto_Distance(sr.Symbol)); screenResults.Add(ResultType.YULE, clone.Yule_Distance(sr.Symbol)); } return(screenResults); }