public Form1() { InitializeComponent(); m_InkOverlay = new InkOverlay(); m_InkOverlay.AttachedControl = panel1; m_InkOverlay.Enabled = true; m_Sketch = new msInkToHMCSketch.InkSketch(m_InkOverlay.Ink); m_ImageTemplates = new List <ImageTemplate>(); string dir = System.IO.Directory.GetCurrentDirectory(); System.IO.DirectoryInfo info = System.IO.Directory.GetParent(dir); info = System.IO.Directory.GetParent(info.FullName); dir = info.FullName + "\\Training Data"; m_DollarTemplates = DollarTemplate.LoadTemplates(dir); m_CompleteSymbols = new List <BitmapSymbol>(); m_PartialSymbols = new List <BitmapSymbol>(); }
public Dictionary <Sketch.Substroke, GatePart> RecognizeStrokesRubine(List <Sketch.Substroke> subs) { Dictionary <Sketch.Substroke, GatePart> strokeResults = new Dictionary <Sketch.Substroke, GatePart>(subs.Count); foreach (Sketch.Substroke s in subs) { DollarTemplate dollar = new DollarTemplate(s.PointsL); Dictionary <DollarTemplate, double> dResults = dollar.RecognizeSymbol(m_DollarTemplates); if (dResults == null) { return(strokeResults); } KeyValuePair <DollarTemplate, double> top = new KeyValuePair <DollarTemplate, double>(); foreach (KeyValuePair <DollarTemplate, double> pair in dResults) { top = pair; break; } DollarTemplate Tbest = top.Key; switch (Tbest.Name) { case "BackLine": strokeResults.Add(s, GatePart.BackLine); break; case "Or_Left": strokeResults.Add(s, GatePart.BackArc); break; case "Or_Right": strokeResults.Add(s, GatePart.FrontArc); break; case "Or_RightTop": strokeResults.Add(s, GatePart.TopArc); break; case "Or_RightBottom": strokeResults.Add(s, GatePart.BottomArc); break; case "And_Left": strokeResults.Add(s, GatePart.BackLine); break; case "And_Right": strokeResults.Add(s, GatePart.FrontArc); break; case "And_Or_Right": strokeResults.Add(s, GatePart.FrontArc); break; case "Not_Triangle": strokeResults.Add(s, GatePart.Triangle); break; case "Not_Bubble": strokeResults.Add(s, GatePart.Bubble); break; case "Bubble": strokeResults.Add(s, GatePart.Bubble); break; } } return(strokeResults); }