public LicensePlateRecognitionForm() { InitializeComponent(); _licensePlateDetector = new LicensePlateDetector(""); ProcessImage(new Image <Bgr, byte>("license-plate.jpg")); }
public LicensePlateRecognitionForm() { InitializeComponent(); _licensePlateDetector = new LicensePlateDetector(); ProcessImage(new Image<Bgr, byte>("license-plate.jpg")); }
public LicensePlateRecognitionForm() { InitializeComponent(); _licensePlateDetector = new LicensePlateDetector(""); ProcessImage(new Image <Bgr, byte>(@"..\..\sample.jpg")); //ProcessImage(new Image<Bgr, byte>(@"..\..\s1.jpg")); }
public MainWindow() { InitializeComponent(); ActivationNetwork net = (ActivationNetwork)Network.Load("net-numbers"); ActivationNetwork netLetters = (ActivationNetwork)Network.Load("net-lt"); _detector = new LicensePlateDetector(net, netLetters); }
public override void ViewDidLoad() { base.ViewDidLoad(); RootElement root = Root; root.UnevenRows = true; UIImageView imageView = new UIImageView(View.Frame); StringElement messageElement = new StringElement(""); StringElement licenseElement = new StringElement(""); root.Add(new Section() { new StyledStringElement("Process", delegate { using (Image<Bgr, Byte> image = new Image<Bgr, byte>( "license-plate.jpg")) { LicensePlateDetector detector = new LicensePlateDetector("."); Stopwatch watch = Stopwatch.StartNew(); // time the detection process List<IInputOutputArray> licensePlateImagesList = new List<IInputOutputArray>(); List<IInputOutputArray> filteredLicensePlateImagesList = new List<IInputOutputArray>(); List<RotatedRect> licenseBoxList = new List<RotatedRect>(); List<string> words = detector.DetectLicensePlate( image, licensePlateImagesList, filteredLicensePlateImagesList, licenseBoxList); watch.Stop(); //stop the timer messageElement.Value = String.Format("{0} milli-seconds", watch.Elapsed.TotalMilliseconds); StringBuilder builder = new StringBuilder(); foreach (String w in words) builder.AppendFormat("{0} ", w); licenseElement.Value = builder.ToString(); messageElement.GetImmediateRootElement().Reload(messageElement, UITableViewRowAnimation.Automatic); licenseElement.GetImmediateRootElement().Reload(licenseElement, UITableViewRowAnimation.Automatic); foreach (RotatedRect box in licenseBoxList) { image.Draw(box, new Bgr(Color.Red), 2); } Size frameSize = FrameSize; using (Mat resized = new Mat()) { CvInvoke.ResizeForFrame(image, resized, frameSize); imageView.Image = resized.ToUIImage(); imageView.Frame = new RectangleF(PointF.Empty, resized.Size); } imageView.SetNeedsDisplay(); ReloadData(); } } )}); root.Add(new Section("Recognition Time") { messageElement }); root.Add(new Section("License Plate") { licenseElement }); root.Add(new Section() { imageView }); }
public LicensePlateRecognitionForm() { InitializeComponent(); _licensePlateDetector = new LicensePlateDetector("x64/"); //Mat m = new Mat("license-plate.jpg"); //UMat um = m.GetUMat(AccessType.ReadWrite); //imageBox1.Image = um; //ProcessImage(m); }
public LicensePlateRecognitionForm() { InitializeComponent(); _licensePlateDetector = new LicensePlateDetector(""); Mat m = new Mat("license-plate.jpg", LoadImageType.AnyColor); UMat um = m.ToUMat(AccessType.ReadWrite); imageBox1.Image = um; ProcessImage(m); }
public LicensePlateRecognitionForm() { InitializeComponent(); _licensePlateDetector = new LicensePlateDetector(""); capture = new Capture("license-plate.jpg"); m = capture.QueryFrame(); UMat um = m.ToUMat(AccessType.ReadWrite); pictureBox1.Image = m.Bitmap; ProcessImage(m); }
public LicensePlateRecognitionForm() { InitializeComponent(); _licensePlateDetector = new LicensePlateDetector(""); Mat m = new Mat(@"..\..\license-plate.jpg", LoadImageType.AnyColor); UMat um = m.ToUMat(AccessType.ReadWrite); ibImageSource.Image = um; ProcessImage(m); ibImageSource.SizeMode = PictureBoxSizeMode.StretchImage; }
public LicensePlateRecognitionForm() { InitializeComponent(); System.Net.ServicePointManager.Expect100Continue = true; System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; _licensePlateDetector = new LicensePlateDetector(""); Mat m = new Mat("license-plate.jpg"); UMat um = m.GetUMat(AccessType.ReadWrite); imageBox1.Image = um; ProcessImage(m); }
private static List <string> LicensePlateRecognitionInit() { _licensePlateDetector = new LicensePlateDetector(); var image = new Image <Bgr, byte>("license-plate.jpg"); // time the detection process Stopwatch watch = Stopwatch.StartNew(); var licensePlateImagesList = new List <Image <Gray, byte> >(); var filteredLicensePlateImagesList = new List <Image <Gray, byte> >(); var licenseBoxList = new List <MCvBox2D>(); var words = _licensePlateDetector.DetectLicensePlate( image, licensePlateImagesList, filteredLicensePlateImagesList, licenseBoxList); watch.Stop(); //stop the timer return(words); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); OnImagePicked += (sender, image) => { if (image == null) return; ISharedPreferences preference = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); String appVersion = PackageManager.GetPackageInfo(PackageName, Android.Content.PM.PackageInfoFlags.Activities).VersionName; if (!preference.Contains("tesseract-data-version") || !preference.GetString("tesseract-data-version", null).Equals(appVersion) || !preference.Contains("tesseract-data-path")) { AndroidFileAsset.OverwriteMethod overwriteMethod = AndroidFileAsset.OverwriteMethod.AlwaysOverwrite; FileInfo a8 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.traineddata", "tmp", overwriteMethod); FileInfo a0 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.bigrams", "tmp", overwriteMethod); FileInfo a1 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.fold", "tmp", overwriteMethod); FileInfo a2 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.lm", "tmp", overwriteMethod); FileInfo a3 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.nn", "tmp", overwriteMethod); FileInfo a4 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.params", "tmp", overwriteMethod); FileInfo a5 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.size", "tmp", overwriteMethod); FileInfo a6 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.word-freq", "tmp", overwriteMethod); FileInfo a7 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.tesseract_cube.nn", "tmp", overwriteMethod); //save tesseract data path ISharedPreferencesEditor editor = preference.Edit(); editor.PutString("tesseract-data-version", appVersion); editor.PutString("tesseract-data-path", System.IO.Path.Combine(a0.DirectoryName, "..") + System.IO.Path.DirectorySeparatorChar); editor.Commit(); } LicensePlateDetector detector = new LicensePlateDetector(preference.GetString("tesseract-data-path", null)); Stopwatch watch = Stopwatch.StartNew(); // time the detection process List<IInputOutputArray> licensePlateImagesList = new List<IInputOutputArray>(); List<IInputOutputArray> filteredLicensePlateImagesList = new List<IInputOutputArray>(); List<RotatedRect> licenseBoxList = new List<RotatedRect>(); List<string> words = detector.DetectLicensePlate( image, licensePlateImagesList, filteredLicensePlateImagesList, licenseBoxList); watch.Stop(); //stop the timer StringBuilder builder = new StringBuilder(); builder.Append(String.Format("{0} milli-seconds. ", watch.Elapsed.TotalMilliseconds)); foreach (String w in words) builder.AppendFormat("{0} ", w); SetMessage(builder.ToString()); foreach (RotatedRect box in licenseBoxList) { Rectangle rect = box.MinAreaRect(); image.Draw(rect, new Bgr(System.Drawing.Color.Red), 2); } SetImageBitmap(image.ToBitmap()); image.Dispose(); }; OnButtonClick += delegate { PickImage("license-plate.jpg"); }; }