Esempio n. 1
0
 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
                         ));
 }
Esempio n. 2
0
        private PlateVerticalGraph HistogramYaxis(Bitmap bitmap)
        {
            PlateVerticalGraph graph = new PlateVerticalGraph(this);
            int w = bitmap.Width;
            int h = bitmap.Height;

            for (int y = 0; y < h; y++)
            {
                float counter = 0;
                for (int x = 0; x < w; x++)
                {
                    counter += GetBrightness(bitmap, x, y);
                }
                graph.AddPeak(counter);
            }
            return(graph);
        }
Esempio n. 3
0
        public void Normalize()
        {
            Plate clone1 = Clone();

            clone1.VerticalEdgeDetector(clone1.GetBitmap());
            PlateVerticalGraph vertical = clone1.HistogramYaxis(clone1.GetBitmap());

            Image           = CutTopBottom(Image, vertical);
            PlateCopy.Image = CutTopBottom(PlateCopy.Image, vertical);

            Plate clone2 = Clone();

            if (HorizontalDetectionType == 1)
            {
                clone2.HorizontalEdgeDetector(clone2.GetBitmap());
            }
            PlateHorizontalGraph horizontal = clone1.HistogramXAxis(clone2.GetBitmap());

            Image           = CutLeftRight(Image, horizontal);
            PlateCopy.Image = CutLeftRight(PlateCopy.Image, horizontal);
        }
Esempio n. 4
0
 public PeakComparer(PlateVerticalGraph graph)
 {
     this.graphHandle = graph;
 }