private static object GetInterior(BackgroundValue bp, IEnumerable <Bitmap> positives) { //Get the actual pattern Bitmap pattern = null; switch (bp.Type) { case "single": pattern = MostFrequentPixel(bp, positives); break; case "horizontal": pattern = MostFrequentColumn(bp, positives); break; case "vertical": pattern = MostFrequentRow(bp, positives); break; } if (pattern == null) { return(null); } //Get the matching strategy and what was missed string matcher = null; int missed = 0; switch (bp.Type) { case "single": case "horizontal": matcher = "horizontal"; foreach (Bitmap bmp in positives) { missed += HorizontalPatternMatcher.Missed(pattern, bmp, bp); } break; case "vertical": matcher = "vertical"; foreach (Bitmap bmp in positives) { missed += VerticalPatternMatcher.Missed(pattern, bmp, bp); } break; } BackgroundResults results = new BackgroundResults(); results.Region = new Region(matcher, pattern); results.Missed = missed; return(results); }
private static object GetInterior(BackgroundValue bp, IEnumerable<Bitmap> positives) { //Get the actual pattern Bitmap pattern = null; switch (bp.Type) { case "single": pattern = MostFrequentPixel(bp, positives); break; case "horizontal": pattern = MostFrequentColumn(bp, positives); break; case "vertical": pattern = MostFrequentRow(bp, positives); break; } if (pattern == null) return null; //Get the matching strategy and what was missed string matcher = null; int missed = 0; switch (bp.Type) { case "single": case "horizontal": matcher = "horizontal"; foreach (Bitmap bmp in positives) missed += HorizontalPatternMatcher.Missed(pattern, bmp, bp); break; case "vertical": matcher = "vertical"; foreach (Bitmap bmp in positives) missed += VerticalPatternMatcher.Missed(pattern, bmp, bp); break; } BackgroundResults results = new BackgroundResults(); results.Region = new Region(matcher, pattern); results.Missed = missed; return results; }