public List <Character> GetChars() { List <Character> output = new List <Character>(); List <Graph.Peak> peaks = ComputeGraph(); for (int i = 0; i < peaks.Count; i++) { Graph.Peak p = peaks[i]; if (p.GetDiff() <= 0) { continue; } output.Add(new Character( Image.Clone(new Rectangle( p.Left, 0, p.GetDiff(), Image.Height ), PixelFormat.Format8bppIndexed ) , PlateCopy.Image.Clone(new Rectangle( p.Left, 0, p.GetDiff(), Image.Height ), PixelFormat.Format8bppIndexed ), new PositionInPlate(p.Left, p.Right ) ) ); } return(output); }
private Bitmap CutTopBottom(Bitmap origin, PlateVerticalGraph graph) { graph.ApplyProbabilityDistributor(new Graph.ProbabilityDistributor(0f, 0f, 2, 2)); Graph.Peak p = graph.FindPeak(3)[0]; return(origin.Clone(new Rectangle(0, p.Left, Image.Width, p.GetDiff()), PixelFormat.Format8bppIndexed )); }
private Bitmap CutLeftRight(Bitmap origin, PlateHorizontalGraph graph) { graph.ApplyProbabilityDistributor(new Graph.ProbabilityDistributor(0f, 0f, 2, 2)); List <Graph.Peak> peaks = graph.FindPeak(3); if (peaks.Count != 0) { Graph.Peak p = peaks[0]; return(origin.Clone(new Rectangle(p.Left, 0, p.GetDiff(), Image.Height), PixelFormat.Format8bppIndexed)); } return(origin); }
public List <Plate> GetPlates() { List <Plate> output = new List <Plate>(); List <Graph.Peak> peaks = ComputeGraph(); for (int i = 0; i < peaks.Count; i++) { Graph.Peak p = peaks[i]; output.Add(new Plate( Image.Clone(new Rectangle( p.Left, 0, p.GetDiff(), Image.Height ), Image.PixelFormat ))); } return(output); }
public List <Band> GetBands() { List <Band> output = new List <Band>(); List <Graph.Peak> peaks = ComputeGraph(); for (int i = 0; i < peaks.Count; i++) { Graph.Peak peak = peaks[i]; output.Add(new Band( Image.Clone(new Rectangle( 0, peak.Left, Image.Width, peak.GetDiff() ), Image.PixelFormat ) ) ); } return(output); }