Пример #1
0
        public void ProcessImage(string urlImage)       //Görüntünün işlendiği metot.
        {
            Stopwatch watch = Stopwatch.StartNew();     //Görüntünün işlenmesi sırasında süre tutulması için süre başlatılmaktadır.

            Bitmap root         = new Bitmap(urlImage); //Root Image (Default Image)
            Bitmap bmp          = new Bitmap(root);     //Resize Image
            Bitmap bmp1         = new Bitmap(root);     //Smoothing Image
            Bitmap bmp2         = new Bitmap(root);     //Color Filtering Image
            string outputstring = "";

            ///Root
            outputstring          = this.Ocr(root);
            txtNumbePlate1.Text   = outputstring;
            ptBNumberPlate1.Image = root;


            //Resize Image to : 1920x1080
            outputstring = "";
            ResizeBilinear filterr = new ResizeBilinear(1920, 1080);

            bmp = filterr.Apply(bmp);

            outputstring          = this.Ocr(bmp);
            txtNumbePlate2.Text   = outputstring;
            ptBNumberPlate2.Image = bmp;


            //Smoothing
            outputstring = "";
            if (BitmapFilter.GaussianBlur(bmp1, 4))
            {
                if (BitmapFilter.GaussianBlur(bmp1, 4))
                {
                    if (BitmapFilter.MeanRemoval(bmp1, 9))
                    {
                    }
                }
            }
            outputstring          = this.Ocr(bmp1);
            txtNumbePlate3.Text   = outputstring;
            ptBNumberPlate3.Image = bmp1;


            //Color Filtering
            outputstring = "";
            ColorFiltering filter = new ColorFiltering();

            filter.Green = new IntRange(175, 255);
            bmp2         = filter.Apply(bmp2);

            outputstring          = this.Ocr(bmp2);
            txtNumbePlate4.Text   = outputstring;
            ptBNumberPlate4.Image = bmp2;

            watch.Stop(); //Stop The Timer
            lblTime.Text  = String.Format("Total Time : {0} Seconds", watch.Elapsed.TotalSeconds);
            lblCount.Text = position.ToString() + "/" + lstimages.Count.ToString();
            System.Threading.Thread.Sleep(5000);
        }
Пример #2
0
        public static bool MeanRemoval(Bitmap b, int nWeight /* default to 9*/)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(-1);
            m.Pixel  = nWeight;
            m.Factor = nWeight - 8;

            return(BitmapFilter.Conv3x3(b, m));
        }
Пример #3
0
        public static bool Smooth(Bitmap b, int nWeight /* default to 1 */)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(1);
            m.Pixel  = nWeight;
            m.Factor = nWeight + 8;

            return(BitmapFilter.Conv3x3(b, m));
        }
Пример #4
0
        public static bool EdgeDetectQuick(Bitmap b)
        {
            ConvMatrix m = new ConvMatrix();

            m.TopLeft    = m.TopMid = m.TopRight = -1;
            m.MidLeft    = m.Pixel = m.MidRight = 0;
            m.BottomLeft = m.BottomMid = m.BottomRight = 1;
            m.Offset     = 127;

            return(BitmapFilter.Conv3x3(b, m));
        }
Пример #5
0
        public static bool EmbossLaplacian(Bitmap b)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(-1);
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 0;
            m.Pixel  = 4;
            m.Offset = 127;

            return(BitmapFilter.Conv3x3(b, m));
        }
Пример #6
0
        public static bool Sharpen(Bitmap b, int nWeight /* default to 11*/)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(0);
            m.Pixel  = nWeight;
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = -2;
            m.Factor = nWeight - 8;

            return(BitmapFilter.Conv3x3(b, m));
        }
Пример #7
0
        public static bool GaussianBlur(Bitmap b, int nWeight /* default to 4*/)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(1);
            m.Pixel  = nWeight;
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 2;
            m.Factor = nWeight + 12;

            return(BitmapFilter.Conv3x3(b, m));
        }