Advertisement
Sparrowvivek16

Find License Plate

Nov 13th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 KB | None | 0 0
  1.  public void FindLicensePlate(Bitmap image)
  2.         {
  3.             Image<Bgr, byte> frame = new Image<Bgr, byte>(image);
  4.             using (Image<Gray, byte> grayframe = new Image<Gray, byte>(image))
  5.             {
  6.  
  7.  
  8.                 var faces =
  9.                        grayframe.DetectHaarCascade(
  10.                                new HaarCascade(Application.StartupPath + "\\output-hv-33-x25.xml"), 1.1, 8,
  11.                                HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
  12.                                new Size(0, 0)
  13.                                )[0];
  14.                 foreach (var face in faces)
  15.                 {
  16.                     Image<Bgr, Byte> tmp = frame.Copy();
  17.                     tmp.ROI = face.rect;
  18.  
  19.                     frame.Draw(face.rect, new Bgr(Color.Blue), 2);
  20.  
  21.                     PlateImagesList.Add(tmp.Resize(500, 500, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC, true));
  22.  
  23.                     //Image<Gray, byte> tmp2 = new Image<Gray, byte>(tmp.ToBitmap());
  24.                     //tmp2 = tmp2.ThresholdBinary(new Gray(50), new Gray(255));
  25.  
  26.                     pictureBox1.Image = tmp.ToBitmap();
  27.                     pictureBox1.Update();
  28.                     //string pl = this.Ocr(tmp2.ToBitmap());
  29.  
  30.                     //PlateTextList.Add(pl);
  31.                 }
  32.  
  33.                 Image<Bgr, Byte> showimg = new Image<Bgr, Byte>(image.Size);
  34.                 showimg = frame.Resize(imageBox1.Width, imageBox1.Height, 0);
  35.                 imageBox1.Image = showimg;
  36.  
  37.             }
  38.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement