private void button_Click(object sender, RoutedEventArgs e) { OpenFileDialog fileForm = new OpenFileDialog(); if (fileForm.ShowDialog() == true) { var file = new FileAndPathInfo(); var plate = new Plate(); //wczytanie pliku file.FileBytes = File.ReadAllBytes(fileForm.FileName); file.FilePath = System.IO.Path.GetDirectoryName(fileForm.FileName); file.FileName = fileForm.FileName; // file.ImageArray = file.FileBytes.ToArray(); //rozpoznanie var plateRecogn = new PlatesRecognizionHelper("C:\\Users\\Tomek\\TabliceRejestracyjne\\TabliceRejestracyjne\\tessdata\\"); //plateRecogn.DetectLicensePlate(arr, null, null, null); // IInputArray arr = new IInputArray(); Mat m1 = new Mat(file.FileName, LoadImageType.Unchanged); var j = plateRecogn.DetectLicensePlate(m1, plate.LicensePlateImagesList, plate.FilteredLicensePlateImagesList, plate.DetectedLicensePlateRegionList); } }
public void SelectPhoto() { OpenFileDialog fileForm = new OpenFileDialog(); if (fileForm.ShowDialog() == true) { var file = new FileAndPathInfo(); var plate = new Plate(); //wczytanie pliku file.FileBytes = File.ReadAllBytes(fileForm.FileName); file.FilePath = System.IO.Path.GetDirectoryName(fileForm.FileName); PhotoPath = file.FileName = fileForm.FileName; // file.ImageArray = file.FileBytes.ToArray(); //rozpoznanie var path = Environment.CurrentDirectory; var plateRecogn = new PlatesRecognizionHelper(string.Format(@"{0}{1}", Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\")), @"tessdata\")); //plateRecogn.DetectLicensePlate(arr, null, null, null); // IInputArray arr = new IInputArray(); Mat m1 = new Mat(file.FileName, LoadImageType.Unchanged); var j = plateRecogn.DetectLicensePlate(m1, plate.LicensePlateImagesList, plate.FilteredLicensePlateImagesList, plate.DetectedLicensePlateRegionList); } }