示例#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
文件: Filters.cs 项目: omeryucel/OCR
        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
文件: Filters.cs 项目: omeryucel/OCR
        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
文件: Filters.cs 项目: omeryucel/OCR
        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
文件: Filters.cs 项目: omeryucel/OCR
        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
文件: Filters.cs 项目: omeryucel/OCR
        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
文件: Filters.cs 项目: omeryucel/OCR
        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));
        }