Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void FindLicensePlate(Bitmap image)
- {
- Image<Bgr, byte> frame = new Image<Bgr, byte>(image);
- using (Image<Gray, byte> grayframe = new Image<Gray, byte>(image))
- {
- var faces =
- grayframe.DetectHaarCascade(
- new HaarCascade(Application.StartupPath + "\\output-hv-33-x25.xml"), 1.1, 8,
- HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
- new Size(0, 0)
- )[0];
- foreach (var face in faces)
- {
- Image<Bgr, Byte> tmp = frame.Copy();
- tmp.ROI = face.rect;
- frame.Draw(face.rect, new Bgr(Color.Blue), 2);
- PlateImagesList.Add(tmp.Resize(500, 500, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC, true));
- //Image<Gray, byte> tmp2 = new Image<Gray, byte>(tmp.ToBitmap());
- //tmp2 = tmp2.ThresholdBinary(new Gray(50), new Gray(255));
- pictureBox1.Image = tmp.ToBitmap();
- pictureBox1.Update();
- //string pl = this.Ocr(tmp2.ToBitmap());
- //PlateTextList.Add(pl);
- }
- Image<Bgr, Byte> showimg = new Image<Bgr, Byte>(image.Size);
- showimg = frame.Resize(imageBox1.Width, imageBox1.Height, 0);
- imageBox1.Image = showimg;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement