Пример #1
0
        /// <summary>
        /// Phương thức được sử dụng để xuất biển số xe ra màn hình
        /// </summary>
        /// <param name="PlateImagesList">Danh sách khung xe lấy được</param>
        /// <param name="hinhbienso">Giá trị xuất Hình ảnh khung xe</param>
        public string GetRecoginatinon(List <Image <Bgr, byte> > PlateImagesList, out Bitmap hinhbienso)
        {
            Image <Bgr, byte> src = new Image <Bgr, byte>(PlateImagesList[0].ToBitmap());
            Bitmap            grayframe;
            List <Rectangle>  listRect = new List <Rectangle>();
            List <Mat>        listMat  = new List <Mat>();

            FindContours con = new FindContours();

            con.IdentifyContours(src.Bitmap, out grayframe, out listRect, out listMat);
            hinhbienso = grayframe;
            Image <Gray, byte> dst = new Image <Gray, byte>(grayframe);

            grayframe = dst.ToBitmap();
            string zz = "";

            grayframe = dst.ToBitmap();
            if (listMat.Count >= 7)
            {
                for (int i = 0; i < listMat.Count; i++)
                {
                    //CvInvoke.Imshow(i.ToString(), listMat[i]);
                    char cs = Recoginatinon(_svm, listMat[i]);
                    zz += cs;
                }
            }

            string replacement = Regex.Replace(zz, @"\t|\n|\r", "");

            char[] arr = replacement.ToCharArray();
            Array.Reverse(arr);
            return(new string(arr));
        }
Пример #2
0
        private void Reconize(string link, out Image hinhbienso, out string bienso, out string bienso_text)
        {
            for (int i = 0; i < box.Length; i++)
            {
                this.Controls.Remove(box[i]);
            }

            hinhbienso  = null;
            bienso      = "";
            bienso_text = "";
            ProcessImage(link);
            if (PlateImagesList.Count != 0)
            {
                Image <Bgr, byte> src = new Image <Bgr, byte>(PlateImagesList[0].ToBitmap());
                pictureBox2.Image = PlateImagesList[0].ToBitmap();
                CvInvoke.Imwrite("BienSoXe.jpg", PlateImagesList[0].Mat);
                Bitmap           grayframe;
                FindContours     con      = new FindContours();
                List <Rectangle> listRect = new List <Rectangle>();
                List <Mat>       listMat  = new List <Mat>();
                Bitmap           color;

                Image <Gray, byte> demo;

                IdentifyContours(src.Bitmap, out grayframe, out listRect, out listMat);

                Image <Gray, byte> dst = new Image <Gray, byte>(grayframe);
                grayframe = dst.ToBitmap();
                string zz = "";
                for (int i = 0; i < listMat.Count; i++)
                {
                    char cs = Recoginatinon(svm, listMat[i]);
                    zz += cs;
                }

                string replacement = Regex.Replace(zz, @"\t|\n|\r", "");
                txtLPR.Text = replacement;
                char[] arr = replacement.ToCharArray();
                Array.Reverse(arr);
                txtLPR.Text = new string(arr);
            }
        }
Пример #3
0
        /// <summary>
        /// Phương thức được sử dụng để xuất biển số xe ra màn hình
        /// </summary>
        /// <param name="link">Đường dẫn tới hình</param>
        /// <param name="hinhbienso">Giá trị xuất ra hình biển số</param>
        /// <param name="bienso_text">Giá trị xuất ra chữ số dưới dạng text</param>
        private void Reconize(Bitmap link, out Bitmap hinhbienso, out string bienso_text, CascadeClassifier plate)
        {
            hinhbienso  = null;
            bienso_text = "";
            Image             Plate_Draw;
            Image <Bgr, byte> PlateImagesResize;

            ProcessImage(link, out Plate_Draw, out PlateImagesResize, plate);
            if (PlateImagesList.Count != 0)
            {
                Image <Bgr, byte> src = new Image <Bgr, byte>(PlateImagesList[0].ToBitmap());
                Bitmap            grayframe;
                List <Rectangle>  listRect = new List <Rectangle>();
                List <Mat>        listMat  = new List <Mat>();

                FindContours con = new FindContours();
                con.IdentifyContours(src.Bitmap, out grayframe, out listRect, out listMat);
                hinhbienso = grayframe;
                Image <Gray, byte> dst = new Image <Gray, byte>(grayframe);
                grayframe = dst.ToBitmap();
                string zz = "";

                grayframe = dst.ToBitmap();
                if (listMat.Count >= 7)
                {
                    for (int i = 0; i < listMat.Count; i++)
                    {
                        CvInvoke.Imshow(i.ToString(), listMat[i]);
                        char cs = Recoginatinon(_svm, listMat[i]);
                        zz += cs;
                    }
                }

                string replacement = Regex.Replace(zz, @"\t|\n|\r", "");
                char[] arr         = replacement.ToCharArray();
                Array.Reverse(arr);
                bienso_text = new string(arr);
            }
        }
Пример #4
0
        /// <summary>
        /// Phương thức được sử dụng để xác định vùng bao quanh tất cả các con số trong biển số xe
        /// </summary>
        /// <param name="link">Đường dẫn tới hình</param>
        /// <param name="hinhbienso">Giá trị xuất ra hình biển số</param>
        /// <param name="listRect">Giá trị xuất ra danh sách vùng bao quanh các chữ số xe</param>
        /// <param name="listMat">Giá trị xuất ra danh sách hình các chữ số xe</param>
        public bool DetectRectangleLPR(Bitmap link, out Bitmap hinhbienso, out List <Rectangle> listRect, out List <Mat> listMat, CascadeClassifier plate)
        {
            hinhbienso = null;
            Image             Plate_Draw        = null;
            Image <Bgr, byte> PlateImagesResize = null;

            ProcessImage(link, out Plate_Draw, out PlateImagesResize, plate);
            listRect = null;
            listMat  = null;
            if (PlateImagesList.Count != 0)
            {
                Image <Bgr, byte> src = new Image <Bgr, byte>(PlateImagesList[0].ToBitmap());
                Bitmap            grayframe;
                //CvInvoke.Imshow("tEST",src);
                //Image<Bgr, byte> imageAAA = new Image<Bgr, byte>("D:\\Test\\Test\\1.jpg");
                FindContours con = new FindContours();
                con.IdentifyContours(src.Bitmap, out grayframe, out listRect, out listMat);
                hinhbienso = grayframe;
                Image <Gray, byte> dst = new Image <Gray, byte>(grayframe);
                grayframe = dst.ToBitmap();
                return(true);
            }
            return(false);
        }