Example #1
0
        private void performOCR(FileInfo imageFile)
        {
            try
            {
                string outputFilename = imageFile.FullName.Substring(inputFolder.Length + 1);
                OCRHelper.PerformOCR(imageFile.FullName, Path.Combine(outputFolder, outputFilename), curLangCode, selectedPSM, outputFormat, bulkDeskewEnabled);
            }
            catch
            {
                // Sets the UI culture to the selected language.
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedUILanguage);

                //this.statusForm.TextBox.BeginInvoke(new UpdateStatusEvent(this.WorkerUpdate), new Object[] { "\t** " + Properties.Resources.Cannotprocess + imageFile.Name + " **" });
            }
        }
Example #2
0
        private void AutoOCR()
        {
            FileInfo imageFile;

            try
            {
                imageFile = new FileInfo(queue.Dequeue());
                if (imageFile == null || !imageFile.Exists)
                {
                    return;
                }
            }
            catch
            {
                return;
            }

            Dispatcher.BeginInvoke(new Action <string>(WorkerUpdate), DispatcherPriority.Normal, imageFile.FullName);

            if (curLangCode == null)
            {
                Dispatcher.BeginInvoke(new Action <string>(WorkerUpdate), DispatcherPriority.Normal, "\t** " + Properties.Resources.selectLanguage + " **");
                //queue.Clear();
                return;
            }

            try
            {
                OCRHelper.PerformOCR(imageFile.FullName, Path.Combine(outputFolder, imageFile.Name), curLangCode, selectedPSM, outputFormat, watchDeskewEnabled);
            }
            catch
            {
                // Sets the UI culture to the selected language.
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedUILanguage);
                Dispatcher.BeginInvoke(new Action <string>(WorkerUpdate), DispatcherPriority.Normal, "\t** " + Properties.Resources.Cannotprocess + imageFile.Name + " **");
            }
        }